visual studiocode,Visual Studio Code(VS Code)入門

 2023-10-18 阅读 23 评论 0

摘要:Visual Studio Code is a popular text editor or code editor to write queries and codes for developers. It is popularly known as VS code. It can highlight and format the code for quick development and understanding purposes. visual studiocode。 Visual Stud

Visual Studio Code is a popular text editor or code editor to write queries and codes for developers. It is popularly known as VS code. It can highlight and format the code for quick development and understanding purposes.

visual studiocode。 Visual Studio Code是一種流行的文本編輯器或代碼編輯器,用于為開發人員編寫查詢和代碼。 它通常被稱為VS代碼。 它可以突出顯示和格式化代碼,以便快速開發和理解。

Visual Studio Code的有用功能 (Useful features of Visual Studio Code)

We may find several features in the VS code as a good text editor.

作為一個好的文本編輯器,我們可能會在VS代碼中找到一些功能。

  • Cross-platform support: VS Code is available on Windows, Linux, and macOS operating systems. You can quickly install it on your favorite platform 跨平臺支持: VS Code在Windows,Linux和macOS操作系統上可用。 您可以將其快速安裝到您喜歡的平臺上
  • Syntax highlighting: As a developer, you may write code in different languages such as t-SQL, PHP, AWS CLI commands, Python, PowerShell, JavaScript. VS Code can highlight language-specific syntax. You do not require to switch to multiple platforms for a specific language 語法突出顯示:作為開發人員,您可以使用不同的語言編寫代碼,例如t-SQL,PHP,AWS CLI命令,Python,PowerShell,JavaScript。 VS Code可以突出顯示特定于語言的語法。 您不需要為特定語言切換到多個平臺
  • Code indentation: VS code also supports for code indentation for different coding languages 代碼縮進: VS代碼還支持不同編碼語言的代碼縮進
  • Plug-in or extensions: It also provides several extensions to enhance the usability of the VS code. These extensions increase the capability of the VS code. You can have extensions for SQL Server, AWS, Python, keyboard shortcuts 插件或擴展:它還提供了幾個擴展來增強VS代碼的可用性。 這些擴展增加了VS代碼的功能。 您可以具有SQL Server,AWS,Python,鍵盤快捷鍵的擴展
  • Tree view representation: It gives you a tree view or hierarchical interface to view your project files, codes. You can easily navigate through different sections using this 樹視圖表示:它為您提供樹視圖或分層界面,以查看您的項目文件和代碼。 您可以使用此按鈕輕松瀏覽不同的部分
  • Integrated terminals: Visual Studio Code provides an integrated terminal for your workspace. You don’t require to switch different windows to perform command-line tasks 集成終端: Visual Studio Code為您的工作區提供集成終端。 您無需切換其他窗口即可執行命令行任務
  • Display language: You can easily configure the desired language in this using the Language Pack extension 顯示語言:您可以使用Language Pack擴展名輕松配置所需的語言
  • Color themes: You can easily customize it with different color schemes. You can quickly modify it as per your preference and environment 顏色主題:您可以使用不同的配色方案輕松自定義它。 您可以根據自己的喜好和環境快速修改它

Windows的VS代碼安裝 (Installation of VS code for Windows)

Navigate to Visual Studio Code URL and choose your desired platform to install the software. You can see the installer for Windows, macOS, and Linux in the below screenshot.

導航到Visual Studio代碼URL,然后選擇所需的平臺來安裝軟件。 您可以在下面的屏幕截圖中看到Windows,macOS和Linux的安裝程序。

Download Visual Studio Code

For Windows, you get an option to download the 32-bit or 64-bit version.

對于Windows,您可以選擇下載32位或64位版本。

Download options

Download the appropriate version and start the installation. Its installation is quick.

下載適當的版本并開始安裝。 它的安裝很快。

You can click on next for installation, but let me highlight the useful step.

您可以單擊“下一步”進行安裝,但讓我突出顯示有用的步驟。

In the setup additional tasks, you get options to integrate VS code with Windows explorer.

在設置其他任務中,您將獲得將VS代碼與Windows資源管理器集成的選項。

  • Add open the code action to the Windows explorer file context menu: You get an option to open a specific file in the VS Code in the right-click menu 在Windows資源管理器文件上下文菜單中添加“打開代碼”操作:在右鍵菜單中的VS Code中,您可以選擇打開特定文件。
  • Add open the code action to Windows explorer directory context menu: Suppose you get multiple scripts in a folder, it is not feasible to open each file individually. In VS Code, you can right-click on the folder, and it opens all files in a single click 在Windows資源管理器目錄的上下文菜單中添加打開代碼操作:假設您在一個文件夾中獲得了多個腳本,則單獨打開每個文件是不可行的。 在VS Code中,您可以右鍵單擊該文件夾,然后單擊即可打開所有文件。
  • Register code as an editor for supported file types: This option registers the visual studio code as a default editor for supported file systems 將代碼注冊為支持的文件類型的編輯器:此選項將Visual Studio代碼注冊為支持的文件系統的默認編輯器
  • Add to path

    添加到路徑

Set additional tasks

VS Code的不同組件和功能 (Different component and features of VS Code)

Launch the Visual Studio code after installation, and the default screen looks like below. On the left side, you have an activity bar.

安裝后啟動Visual Studio代碼,默認屏幕如下所示。 在左側,您有一個活動欄。

Activity bar

This activity bar contains the following tabs.

該活動欄包含以下選項卡。

探險者 (Explorer)

This explorer is to open, browse, and manage the files. You can also use this as a notepad text editor or programing language code. You can open multiple files in an explorer.

該資源管理器用于打開,瀏覽和管理文件。 您也可以將其用作記事本文本編輯器或編程語言代碼。 您可以在資源管理器中打開多個文件。

Explorer

You can split the files as per your requirements – Split Up, Split down, Split left, Spit right.

您可以根據需要拆分文件-拆分,拆分,向左拆分,向右吐。

Split options

For example, once you split down the files, it creates a new region for the split files. In the below screenshot, you get two files splits in the current window. It is useful when you want to compare two or more scripts together or want to reference another script.

例如,拆分文件后,它將為拆分文件創建一個新區域。 在下面的屏幕截圖中,您在當前窗口中拆分了兩個文件。 當您要將兩個或多個腳本一起比較或要引用另一個腳本時,此功能很有用。

Multiple splits

Similarly, you can rearrange editors in multiple groups, split left, right, down in the same editor window.

同樣,您可以在同一編輯器窗口中按左,右,下拆分多個組來重新排列編輯器。

Rearrange windows

搜索 (Search)

It is to search for a specific keyword in all the open files in the editor window. For example, suppose we want to replace the sys.databases with databases keyword in all open files. Enter the keyword and search it in all open editor files. You see each occurrence of the keyword in all editor files. It also shows line after keyword replacement, as highlighted below.

它是在編輯器窗口中所有打開的文件中搜索特定的關鍵字。 例如,假設我們要在所有打開的文件中將sys.databases替換為databases關鍵字。 輸入關鍵字并在所有打開的編輯器文件中搜索。 您會在所有編輯器文件中看到該關鍵字的每次出現。 它還顯示了關鍵字替換后的行,如下所示。

Search

源代碼控制 (Source Control)

Visual Studio Code supports the integration of multiple Source Control providers such as TFS, Git, SVN.

Visual Studio Code支持集成多個源代碼控制提供程序,例如TFS,Git,SVN。

(Run)

You can run the debugger using this tab. You can also customize the debug using a configuration file in JSON format.

您可以使用此選項卡運行調試器。 您還可以使用JSON格式的配置文件來自定義調試。

Source Control

延期 (Extension)

Visual Studio Code extends the functionality and features using the extensions. These extensions are free to download, install, and use. It provides various extensions for different programming languages, formats, keyboard shortcuts, cloud solutions. By default, it gives you the popular and recommended extensions. We will cover separately about the extensions in further articles.

Visual Studio Code使用擴展功能擴展了功能。 這些擴展可以免費下載,安裝和使用。 它為不同的編程語言,格式,鍵盤快捷鍵,云解決方案提供了各種擴展。 默認情況下,它為您提供了流行和推薦的擴展。 我們將在后續文章中分別介紹擴展。

Extension

Once you open a specific file in the VS code, it gives you a recommendation as well. For example, if I open a T-SQL script, it suggests installing the mssql extension for this file type.

在VS代碼中打開特定文件后,它也會為您提供建議。 例如,如果我打開一個T-SQL腳本,則建議為此文件類型安裝mssql擴展名

mssql extension

小地圖 (MiniMap)

VS Code provides a code outline feature to have a high-level overview of code, quickly navigate to a particular area. It is similar to the Scroll Bars feature you get in the recent versions of SQL Server Management Studio. You can refer to New feature in SQL Server Management Studio 2016 – Scroll bar for more details.

VS Code提供了代碼概述功能,可以對代碼進行高級概述,并快速導航到特定區域。 它類似于您在SQL Server Management Studio的最新版本中獲得的“ 滾動條”功能。 您可以參考 SQL Server Management Studio 2016的新功能–滾動條 以了解更多詳細信息。

You get the minimap on the right side of the code editor. We can remove the minimap from the View-> Show minimap.

您會在代碼編輯器的右側獲得小地圖。 我們可以從“視圖”->“顯示小地圖”中刪除小地圖。

Minimap

面包屑 (Breadcrumbs)

Once you open any file in VS Code, it shows its current location on the top, and you can navigate quickly between files and folders. For example, for my script, it gives me the path SQL -> QA -> script name.

在VS Code中打開任何文件后,它將在頂部顯示其當前位置,并且您可以在文件和文件夾之間快速導航。 例如,對于我的腳本,它為我提供了路徑SQL-> QA->腳本名稱。

Breadcrumbs

Suppose I want to take a step back and open the script in the SQL folder. You can click on the corresponding folder, and it gives you a list of files inside the folder. Click on the respective script to open in the query editor window.

假設我想退后一步,在SQL文件夾中打開腳本。 您可以單擊相應的文件夾,它會為您提供該文件夾內文件的列表。 單擊相應的腳本以在查詢編輯器窗口中打開。

Breadcrumbs example

We can disable breadcrumbs using the View > Show Breadcrumbs command as shown below.

我們可以使用“ 視圖” >“ 顯示面包屑”命令禁用面包 ,如下所示。

Disable Breadcrumbs

命令面板 (Command Palette)

You can access all functions of the VS code using the Command Palette. It shows the various tasks, configurations along with the keyboard shortcuts.

您可以使用命令面板訪問VS代碼的所有功能 它顯示了各種任務,配置以及鍵盤快捷鍵。

You can launch a command palette from View -> Command Palette. You can also use Ctrl+Shift+P key combinations.

您可以從“視圖”->“命令面板”啟動命令面板。 您也可以使用Ctrl + Shift + P組合鍵。

Command Palette

It sorts the functions in alphabetical order. You can search for a specific item as well.

它按字母順序對功能進行排序。 您也可以搜索特定項目。

functions in Command Palette

禪宗模式 (Zen Mode)

You can focus on your code using the zen mode in the VS code. It hides the activity bar, status bar, sidebar, and you see code in full-screen mode.

您可以在VS代碼中使用zen模式來專注于代碼。 它隱藏了活動欄,狀態欄,側邊欄,并且您可以在全屏模式下查看代碼。

To open the zen mode, search for the View: Toggle Zen Mode. Alternatively, use the keyboard shortcut Ctrl+K Z.

要打開禪宗模式,請搜索“ 視圖:切換禪宗模式”。 或者,使用鍵盤快捷鍵Ctrl + KZ。

Zen Mode

It brings the code in full-screen mode by hiding all bars. It helps you to focus on your development work—Press Esc to exit the zen mode in VS code.

通過隱藏所有欄,它將代碼帶入全屏模式。 它可以幫助您專注于開發工作-按Esc鍵以VS代碼退出zen模式。

View output of Zen Mode

顏色主題 (Color Themes)

VS Code provides different color schemes to suit your preference and work environment. You can use the theme from the command palette. It supports different themes, as shown below.

VS Code提供不同的配色方案,以適合您的喜好和工作環境。 您可以從命令面板使用主題。 它支持不同的主題,如下所示。

Color Themes

互動游樂場 (Interactive Playground)

Visual Studio Code provides an interactive playground to try out its features. You can launch an interactive playground from the link on the Welcome page.

Visual Studio Code提供了一個交互式游樂場來試用其功能。 您可以從“歡迎”頁面上的鏈接啟動一個交互式游樂場。

Interactive Playground

You can also launch it from the Help > Interactive Playground.

您也可以從“ 幫助” >“ 交互式游樂場”啟動它。

Launch Interactive Playground

You can learn about the useful VS code features in this interactive playground. It gives you a list of editor features such as multi-cursor editing, intelligence, line actions, rename factoring, code folding.

您可以在此交互式游樂場中了解有用的VS代碼功能。 它為您提供了編輯器功能列表,例如多光標編輯,智能,行動作,重命名分解,代碼折疊。

Interactive Playground examples

For example, let’s say we want to explore Multi-cursor editing. It explains the feature and instructs to practice in this interactive window.

例如,假設我們要探索多光標編輯。 它解釋了該功能并指示在此交互式窗口中進行練習。

Multi-cursor editing

Similarly, scroll down, and you see the section for line actions.

同樣,向下滾動,您會看到有關行操作的部分。

Line actions

For example, if we can copy a line and insert it at the above or below position using the shortcut key specified in the example. It is described well so that you can follow the steps and learn these productivity features.

例如,如果我們可以復制一行,并使用示例中指定的快捷鍵將其插入到上方或下方的位置。 對其進行了很好的描述,以便您可以按照以下步驟操作并學習這些生產力功能。

結論 (Conclusion)

In this article, we explored the useful features of the Visual Studio Code, aka VS Code, that serves the purpose of a lightweight and powerful source code editor. You can use it on Windows, Linux, and macOS. We will explore more on its features, extensions in the upcoming articles.

在本文中,我們探討了Visual Studio Code(又名VS Code)的有用功能,該功能可用于輕量級功能強大的源代碼編輯器。 您可以在Windows,Linux和macOS上使用它。 我們將在以后的文章中進一步探討其功能和擴展。

翻譯自: https://www.sqlshack.com/getting-started-with-visual-studio-code-vs-code/

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/144236.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息