1. 程式人生 > >龍芯平臺安裝Visual Studio Code(VSCode)

龍芯平臺安裝Visual Studio Code(VSCode)

克隆並構建repo後,檢視問題列表。標籤為“help wanted 求助”的問題是提交PR的好問題。如果你是第一次在程式碼中出現,那麼標籤為“good first issue 好的首問”的問題將是優先的候選物件。如果您做出了重大更改,請先與問題的受讓人討論,然後再開始處理該問題。

先決條件

為了下載必要的工具,克隆儲存庫,並通過yarn安裝依賴項,您需要能訪問網路。

您需要以下工具:

git

node.js,版本> = 10.16.0,< 11.0.0

yarn,

sudo npm install --global yarn

請遵循安裝指南。https://yarnpkg.com/en/docs/install#alternatives-stable

Python,至少版本2.7(不支援版本3)

適用於您平臺的C/C++編譯器工具鏈:

Linux 作業系統

make

pkg-config

GCC或其他編譯工具鏈

native-keymap需要libX11-dev和libxbfile-dev

sudo dnf install libX11-devel libxkbfile-devel

keytar需要libsecret-1-dev。

sudo dnf install libsecret-devel

構建deb和rpm包需要fakeroot和rpm

sudo dnf install fakeroot rpm

使用yarn安裝和構建所有依賴關係:

cd vscode

yarn

故障排除

如果出現問題,請先嚐試刪除~/.node-gyp,執行yarn cache clean,然後重試。

構建並執行

如果您想了解程式碼是如何工作的,或者想除錯一個問題,那麼您需要獲取原始碼,構建它,並在本地執行該工具。

獲取來源

首先,復刻VS Code軟體源,以便您可以發出一個拖拽請求。然後,在本地克隆您的復刻。

git clone https://github.com/microsoft/vscode.git

偶爾,您會希望將上游儲存庫中的更改(官方程式碼repo)與您的復刻合併。

cd vscode
git checkout master
git pull https://github.com/microsoft/vscode.git master
管理任何合併衝突,提交它們,然後將它們推到您的復刻。

構建
進入vscode並啟動TypeScript增量生成器:

cd vscode
yarn watch
注意:如果您正在執行視窗並已將Visual Studio 2017安裝為您的構建工具,您需要開啟x64 VS 2017本機工具命令提示符。如果已安裝,請不要將其與VS2015 x64本機工具命令提示符混淆。

增量構建器將進行初始完整構建,並且一旦初始構建完成,將顯示包含短語“完成編譯”的訊息。然後,構建器將繼續在終端中執行。它將監視檔案的變化,並逐步編譯這些變化,給你一個快速、迭代的編碼體驗。

小貼士!Linux使用者在執行yarn執行觀察時可能會遇到ENOSPC錯誤,要繞過這一點,請按照常見問題中的說明操作。

小貼士!在您克隆vscode儲存庫的資料夾中開啟VS Code,然後按CMD+SHIFT+B(在Windows、Linux上按CTRL+SHIFT+B)啟動構建器。要檢視構建輸出,請按CMD+SHIFT+U開啟輸出流。

錯誤和警告
開發程式碼時,錯誤和警告將顯示在控制檯中。如果使用VS Code開發程式碼,錯誤和警告會顯示在編輯器左下角的狀態列中。您可以使用“View | Errors and Warnings(檢視|錯誤和警告)”或按CMD+P檢視錯誤列表,然後!。

小貼士!您不需要在每次更改後停止並重新啟動程式碼的開發版本。您只需從命令面板中執行過載視窗。我們喜歡將鍵盤快捷鍵CMD+R(視窗作業系統,Linux)分配給這個命令。

執行

為了測試這些更改,您可以在工作區vscode上啟動VS Code的開發版本,您目前正在編輯該版本。

Linux

./scripts/code.sh

您可以通過Dock或工作列中的以下圖示來識別Code的開發版本(“Code-OSS”):

VS Code default icon

VS程式碼預設圖示

小貼士!如果您收到一個錯誤,說明該應用程式不是有效的Electron app,這可能意味著您沒有先執行yarn watch。

除錯
程式碼具有多程序架構,您的程式碼在不同的程序中執行。

渲染過程在Shell視窗中執行UI使用者介面程式碼。要除錯渲染中執行的程式碼,您可以使用VS Code或chrome開發工具。

使用VSCode

為chrome擴充套件安裝偵錯程式。這個擴充套件將允許您附加和除錯執行在Chrome中的客戶端程式碼。
開啟vscode儲存庫資料夾。
從除錯檢視視窗的啟動下拉列表中選擇“Launch VS Code”啟動配置,然後按F5。

使用chrome開發工具

在Code的開發例項的命令面板中執行命令Developer: Toggle Developer Tools來啟動chrome工具。
由於原始碼連結到線上託管的原始碼對映,因此還可以除錯程式碼的釋出版本。

sourcemaps

擴充套件主機程序執行外掛實現的程式碼。要除錯在擴充套件主機程序中執行的擴充套件(包括Code打包的擴充套件),可以使用VS Code本身。切換到除錯檢視,選擇“Attach to Extension Host“配置,然後按F5。

搜尋過程可以除錯,但必須首先啟動。嘗試連線前,按CMD+P(視窗上的CTRL+P)開始搜尋,否則連線將失敗並超時。

自動化測試

在vscode資料夾中,通過終端直接執行./scripts/test.sh執行單元測試。測試自述檔案包含關於如何執行和除錯測試以及如何生成覆蓋率報告的完整細節。

我們也有自動化的UI使用者介面測試。smoke test README(冒煙測試自述文)件包含所有細節。

單元測試

同自動化測試。

林挺
我們用皮棉作為林挺的貨源。您可以通過從終端或命令提示符呼叫gulp tslint來跨源執行tslint。您也可以通過按下CMD+P(視窗上的CTRL+P)並輸入任務tslint,將tslint作為程式碼任務執行。來自tslint的警告顯示在“錯誤和警告”快速框中,您可以從“程式碼”內部導航到它們。

要在進行更改時去除訊號源的毛,您可以安裝tslint擴充套件。

延長
vscode開源版本中不提供Visual Studio市場。如果您需要使用或除錯擴充套件,您可以檢查擴充套件作者是否在其儲存庫中釋出了構建(檢查構建頁面),或者它是否是開源的,您可以在本地克隆和構建擴充套件。一旦你有了。VSIX,您可以通過命令列或使用“擴充套件檢視”命令下拉列表中的“從VSIX安裝”命令“側載入”擴充套件(請參閱命令列擴充套件管理的更多資訊)。

工作部門
即使您對微軟/vscode儲存庫擁有推送許可權,您也應該建立一個個人分支,並在需要時在那裡建立功能分支。這保持了主儲存庫的乾淨和你個人工作流程的混亂。

拉請求
在我們接受您的請求之前,您需要簽署一份投稿人許可協議。這是一個自動化的過程,你只需要做一次。

為使我們能夠快速審查並接受您的請求,請始終為每個問題建立一個請求,並將該問題連結到請求中。除非有相同的根本原因,否則不要將多個請求合併到一個請求中。請務必遵循我們的編碼指南,並儘可能減少程式碼更改。避免對未經修改的程式碼進行純格式更改。請求應該儘可能包含測試。

在哪裡做出貢獻
檢視完整的問題列表,瞭解所有潛在貢獻領域的列表。請注意,僅僅因為儲存庫中存在一個問題並不意味著我們會接受對它的核心編輯器的貢獻。我們不接受拉動式請求有幾個原因,例如:

效能Visual Studio程式碼的核心價值之一是提供一個輕量級程式碼編輯器,這意味著它應該在真實和感知效能方面都表現良好。
使用者體驗——既然我們想交付輕量級程式碼編輯器,UX也應該感到輕量級,而不是雜亂無章。對使用者介面的大多數更改應該通過問題所有者和/或UX團隊進行。
架構——團隊和/或特性所有者需要同意變更可能產生的任何架構影響。像新的擴充套件APIs這樣的事情必須與特性所有者討論並達成一致。
為了增加合併請求的機會,您應該選擇一個標有需要幫助或錯誤標籤的問題。如果您想要處理的問題沒有標註“需要幫助”或“bug”,您可以與問題所有者開始對話,詢問是否會考慮外部貢獻。

為了避免多個請求解決同一個問題,請在評論中告訴其他人你正在處理這個問題。

包裝
程式碼可以打包用於以下平臺:win32-ia32 | win32-x64 |達爾文| Linux-ia32 | Linux-x64 | Linux-arm

這些吞嚥任務是可用的:

vscode-[平臺]:為[平臺構建打包版本]。
最小:為[平臺構建一個打包的小型版本]。
另請參見:基於Debian的Linux的交叉編譯

建議
我們還對您對程式碼未來的反饋感興趣。您可以通過問題跟蹤器提交建議或功能請求。為了使這一過程更加有效,我們要求其中包含更多資訊,以幫助更清楚地定義它們。

翻譯
我們感謝您的本地化貢獻,無論是提供新的翻譯,對翻譯進行投票,還是建議流程改進。我們通過Transifex服務進行翻譯,而不是通過vscode回購。請訪問我們的本地化網站開始。

討論禮儀
為了保持對話清晰透明,請將討論限制在英語範圍內,並保持話題與問題相關。體諒他人,並始終保持禮貌和專業。

Linting

We use tslint for linting our sources. You can run tslint across the sources by calling gulp tslintfrom a terminal or command prompt. You can also run gulp tslint as a Code task by pressing CMD+P (CTRL+P on Windows) and entering task tslint. Warnings from tslint show up in the Errors and Warnings quick box and you can navigate to them from inside Code.

To lint the source as you make changes you can install the tslint extension.

Extensions

The Visual Studio Marketplace is not available from the vscode open source builds. If you need to use or debug an extension you can check to see if the extension author publishes builds in their repository (check the Builds page) or if it is open source you can clone and build the extension locally. Once you have the .VSIX, you can "side load" the extension either through the command line or using Install from VSIX command in the Extensions View command drop-down (see moreon command line extension management).

Work Branches

Even if you have push rights on the Microsoft/vscode repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your personal workflow cruft out of sight.

Pull Requests

Before we can accept a pull request from you, you'll need to sign a Contributor License Agreement (CLA). It is an automated process and you only need to do it once.

To enable us to quickly review and accept your pull requests, always create one pull request per issue and link the issue in the pull request. Never merge multiple requests in one unless they have the same root cause. Be sure to follow our Coding Guidelines and keep code changes as small as possible. Avoid pure formatting changes to code that has not been modified otherwise. Pull requests should contain tests whenever possible.

Where to Contribute

Check out the full issues list for a list of all potential areas for contributions. Note that just because an issue exists in the repository does not mean we will accept a contribution to the core editor for it. There are several reasons we may not accept a pull request like:

  • Performance - One of Visual Studio Code's core values is to deliver a lightweight code editor, that means it should perform well in both real and perceived performance.
  • User experience - Since we want to deliver a lightweight code editor, the UX should feel lightweight as well and not be cluttered. Most changes to the UI should go through the issue owner and/or the UX team.
  • Architectural - The team and/or feature owner needs to agree with any architectural impact a change may make. Things like new extension APIs must be discussed with and agreed upon by the feature owner.

To improve the chances to get a pull request merged you should select an issue that is labelled with the help-wanted or bug labels. If the issue you want to work on is not labelled with help-wantedor bug, you can start a conversation with the issue owner asking whether an external contribution will be considered.

To avoid multiple pull requests resolving the same issue, let others know you are working on it by saying so in a comment.

Packaging

Code can be packaged for the following platforms: win32-ia32 | win32-x64 | darwin | linux-ia32 | linux-x64 | linux-arm

These gulp tasks are available:

  • vscode-[platform]: Builds a packaged version for [platform].
  • vscode-[platform]-min: Builds a packaged and minified version for [platform].

See also: Cross-Compiling for Debian-based Linux

Suggestions

We're also interested in your feedback for the future of Code. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.

Translations

We appreciate your localization contributions, either by providing new translations, voting on translations, or suggesting process improvements. We take translations through the Transifex service, not through the vscode repo. See our localization site to get started.

Discussion Etiquette

In order to keep the conversation clear and transparent, please limit discussion to English and keep things on topic with the issue. Be considerate to others and try to be courteous and professional at all times.

參考文獻:

《如何從原始碼構建和執行》https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-an