Skip to content

Commit b824781

Browse files
authored
Merge pull request #6874 from dibarbet/merge_main_to_prerelease
Snap main to prerelease
2 parents 7b7da92 + 8bc2a02 commit b824781

File tree

485 files changed

+66599
-20817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+66599
-20817
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
],
3434
"@typescript-eslint/no-namespace": "off",
3535
"@typescript-eslint/promise-function-async": "error",
36+
"prefer-promise-reject-errors": "error",
3637
"curly": "error",
3738
"prettier/prettier": [ "error", { "endOfLine": "auto" } ],
3839
"unicorn/filename-case": [

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This is a generated file from vscode-l10n tool, and it always uses 'lf' and line ending. Set it to 'lf' so we don't get warning every time when localization file get changed.
2+
l10n/bundle.l10n.json text eol=lf
3+
4+
# This is a Unix shell script, so it always use the 'lf' line ends
5+
scripts/remoteProcessPickerScript text eol=lf

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ obj
33
node_modules
44
out
55
.roslyn/
6+
.roslynDevKit/
67
.omnisharp/
78
.omnisharp-*/
89
.vs/
910
.debugger/
1011
.razor/
1112
.razoromnisharp/
13+
.razortelemetry/
1214
.vscode-test/
1315
dist/
1416
*.razor.json

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode"
4+
"esbenp.prettier-vscode",
5+
"orta.vscode-jest"
56
]
67
}

.vscode/launch.json

Lines changed: 106 additions & 166 deletions
Large diffs are not rendered by default.

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
},
1717
"csharp.suppressDotnetRestoreNotification": true,
1818
"typescript.tsdk": "./node_modules/typescript/lib",
19-
"mocha.enabled": true,
2019
"omnisharp.autoStart": false,
2120
"editor.formatOnSave": false,
2221
"eslint.lintTask.enable": true,
23-
"dotnet.defaultSolution": "disable"
22+
"dotnet.defaultSolution": "disable",
23+
"jest.autoRun": "off"
2424
}

.vscodeignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
.logs/**
33
.nyc_output/**
44
!.roslyn/**
5+
!.roslynDevKit/**
56
!.omnisharp/**
67
!.razor/**
78
!.razoromnisharp/**
9+
!.razortelemetry/**
810
.rpt2_cache/**
911
.github/**
1012
.vscode/**
@@ -15,6 +17,11 @@ server/**
1517
src/**
1618
tasks/**
1719
test/**
20+
omnisharptest/**
21+
__mocks__/**
22+
jest.config.ts
23+
baseJestConfig.ts
24+
.prettierignore
1825
typings/**
1926
vsix/**
2027
node_modules
@@ -29,7 +36,6 @@ CODEOWNERS
2936
gulpfile.ts
3037
!install.Lock
3138
ISSUE_TEMPLATE
32-
.mocharc.jsonc
3339
!README.md
3440
!CHANGELOG.md
3541
*.md

CHANGELOG.md

Lines changed: 266 additions & 17 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 129 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,154 @@
1-
## Local development
1+
## Table of Contents
22

3-
### Pre-requisites
3+
- [Setting Up Local Development Environment](#setting-up-local-development-environment)
4+
- [Prerequisites for Development](#prerequisites-for-development)
5+
- [Building, Running, and Testing the Repository](#building-running-and-testing-the-repository)
6+
- [Setting Up Local Language Servers](#setting-up-local-language-servers)
7+
- [Roslyn](#roslyn)
8+
- [Razor](#razor)
9+
- [Debugging Local Language Servers](#debugging-local-language-servers)
10+
- [Configuring Local Language Servers](#configuring-local-language-servers)
11+
- [Finding the `settings.json` file for your workspace](#finding-the-settingsjson-file-for-your-workspace)
12+
- [Configuring Roslyn Language Server](#configuring-roslyn-language-server)
13+
- [Configuring Razor Language Server](#configuring-razor-language-server)
14+
- [Creating VSIX Packages for the Extension](#creating-vsix-packages-for-the-extension)
15+
- [Updating the `Roslyn` Language Server Version](#updating-the-roslyn-language-server-version)
416

5-
First install:
17+
## Setting Up Local Development Environment
618

7-
* Node.js ([v16.16 LTS](https://nodejs.org/en/blog/release/v16.16.0) is recommended).
8-
* Npm (The version shipped with node is fine, for example for v16.16.0 it would be 8.19.2)
19+
Setting up your local development environment for the vscode-csharp repository involves several steps. This guide will walk you through the process.
20+
21+
### Prerequisites for Development
22+
23+
Before you start, make sure you have the following software installed on your machine:
24+
25+
* Node.js ([v18.17.0 LTS](https://nodejs.org/en/blog/release/v18.17.0) is recommended).
26+
* Npm (The version shipped with node is fine)
927
* .NET 7.0 SDK (dotnet should be on your path)
1028

11-
### Build and run the extension
29+
Once you have these installed, you can navigate to the cloned vscode-csharp repository to proceed with building, running, and testing the repository.
30+
31+
### Building, Running, and Testing the Repository
32+
33+
Follow these steps to build, run, and test the repository:
34+
35+
#### Building
36+
37+
1. Run `npm i` - This command installs the project dependencies.
38+
2. Run `npm i -g gulp` - This command installs Gulp globally.
39+
3. Run `gulp installDependencies` - This command downloads the various dependencies as specified by the version in the [package.json](package.json) file.
40+
4. Run `code .` - This command opens the project in Visual Studio Code.
41+
42+
#### Running
43+
44+
After completing the build steps:
45+
46+
1. Run `npm run watch` (Optional) - This command watches for code changes.
47+
2. Press <kbd>Ctrl+Shift+D</kbd> to open the Run view in VS Code and ensure `Launch Extension` is selected.
48+
3. Start debugging by pressing <kbd>F5</kbd>.
49+
50+
#### Testing
51+
52+
To run tests:
53+
54+
1. Execute `npm run test` or press <kbd>F5</kbd> in VS Code with the "Launch Tests" debug configuration selected.
55+
2. For integration tests, select either of the two 'current file' integration tests (one for roslyn and one for razor), from the drop-down and press <kbd>F5</kbd> to start debugging:
56+
- For Roslyn Server: `Launch Current File slnWithCsproj Integration Tests`
57+
- For Razor Server: `Launch Current File BasicRazorApp2_1 Integration Tests`
58+
59+
These will allow you to actually debug the test, but the 'Razor integration tests' configuration does not.
60+
61+
### Setting Up Local Language Servers
62+
63+
This section shows how to set up local Razor or Roslyn language servers for debugging with the VSCode C# extension.
64+
65+
#### Roslyn
66+
67+
1. Clone the [Roslyn repository](https://github.com/dotnet/roslyn). This repository contains the Roslyn server implementation.
68+
2. Follow the build instructions provided in the repository.
69+
70+
The server DLL is typically at `$roslynRepoRoot/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer/Debug/net7.0/Microsoft.CodeAnalysis.LanguageServer.dll`, but this may vary based on the built configuration.
71+
72+
#### Razor
73+
74+
1. Clone the [Razor repository](https://github.com/dotnet/razor). This repository contains the Razor server implementation.
75+
2. Follow the build instructions provided in the repository.
76+
77+
The server DLL is typically at `$razorRepoRoot/artifacts/bin/rzls/Debug/net8.0`.
78+
79+
### Debugging Local Language Servers
80+
81+
Before running the language servers, familiarize yourself with the steps in the [Configuring Local Language Servers](#configuring-local-language-servers) section to configure either the Roslyn or Razor language servers for debugging .
82+
83+
**Note**: You would only need to configure this for the workspace you wish to debug, NOT for the repo root of vscode-csharp repo.
84+
85+
Follow these steps to enable debugging:
86+
87+
1. Press `Ctrl+Shift+D` and then `F5` to launch the extension. This will open a new VS Code instance for `vscode-csharp` repo.
88+
2. In the new VS Code instance, open the project or solution you want to debug.
89+
3. Follow instructions in [Configuring Local Language Servers](#configuring-local-language-servers) to find and configure the workspace settings for the language server you want to debug.
90+
4. Ensure the language server is fully built in Debug mode.
91+
5. Meanwhile in a Visual Studio instance open the `.sln` solution file for the language server you want to debug. Keep this instance open for use in a later step.
92+
6. Back on VS Code, press `Ctrl+Shift+P` and select `Reload Window`. This ensures the changes made in step 3 are applied.
93+
7. After reloading, a window will pop up prompting you to select or open a Visual Studio instance. Now, select the instance you opened in step 5.
94+
8. The language server will now trigger a breakpoint on `Debugger.Launch()` when it starts.
95+
96+
### Configuring Local Language Servers
97+
98+
This section provides instructions on how to debug locally built Roslyn and Razor language servers. You can do this by either directly editing the `settings.json` file of your workspace or through the VSCode settings interface.
1299

13-
To run and develop the extension do the following:
100+
#### Finding the `settings.json` file for your workspace
101+
- Open the Command Palette with `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS)
102+
- Type "Preferences: Open Workspace Settings"
103+
- Select the option that appears.
104+
- In the Workspace Settings tab, in the upper right corner, you'll see an icon that looks like a document with an arrow, which is the "Open Settings (JSON)" button.
105+
- Click on this button to open the `settings.json` file.
14106

15-
* Run `npm i`
16-
* Run `npm i -g gulp`
17-
* Run `gulp installDependencies` (this will download the various dependencies as specified by the version in the [package.json](package.json))
18-
* Open in Visual Studio Code (`code .`)
19-
* _Optional:_ run `npm run watch`, make code changes
20-
* Press <kbd>F5</kbd> to debug
107+
#### Configuring Roslyn Language Server
21108

22-
To **test** do the following: `npm run test` or <kbd>F5</kbd> in VS Code with the "Launch Tests" debug configuration.
109+
In your workspace `settings.json` file, add the following lines:
23110

24-
### Using a locally developed Roslyn server
111+
```json
112+
"dotnet.server.waitForDebugger": true,
113+
"dotnet.server.path": "<roslynRepoRoot>/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer/Debug/net7.0/Microsoft.CodeAnalysis.LanguageServer.dll"
114+
```
25115

26-
https://github.com/dotnet/roslyn contains the server implementation. Follow the instructions there to build the repo as normal. Once built, the server DLL will be located in the build output directory, typically
116+
Replace <roslynRepoRoot> with the actual path to your Roslyn repository.
27117

28-
`$roslynRepoRoot/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer/Debug/net7.0/Microsoft.CodeAnalysis.LanguageServer.dll`
118+
Or, in VSCode settings (`Ctrl+,`):
29119

30-
depending on which configuration is built. Then, launch the extension here and change the VSCode setting `dotnet.server.path` to point to the Roslyn dll path you built above and restart the language server.
120+
1. Search for `dotnet server`.
121+
2. Set `dotnet.server.path` to the path of your Roslyn DLL.
122+
3. Enable `dotnet.server.waitForDebugger`.
31123

32-
If you need to debug the server, you can set the VSCode setting `dotnet.server.waitForDebugger` to true. This will trigger a `Debugger.Launch()` on the server side as it starts.
124+
#### Configuring Razor Language Server
33125

34-
### Using a locally developed Razor server
126+
In your workspace settings.json file, add the following lines:
35127

36-
https://github.com/dotnet/razor contains the server implementation. Follow the instructions there to build the repo as normal. Once built, the server will be located in the build output directory, typically
128+
```json
129+
"razor.languageServer.debug": true,
130+
"razor.languageServer.directory": "<razorRepoRoot>/artifacts/bin/rzls/Debug/net8.0",
131+
"razor.server.trace": "Debug"
132+
```
37133

38-
`$razorRepoRoot/artifacts/bin/rzls/Debug/net7.0`
134+
Replace `$razorRepoRoot` with your actual values.
39135

40-
depending on which configuration is built. Then, launch the extension here and change the VSCode setting `razor.languageServer.directory` to point to the Razor executable path you built above and reload the window.
136+
Or, in VSCode settings (`Ctrl+,`):
41137

42-
If you need to debug the server, you can set the VSCode setting `razor.languageServer.debug` to true. This will trigger a `Debugger.Launch()` on the server side as it starts. You can also set `razor.trace` to `Verbose` to get more log messages in the output window
138+
1. Search for `Razor`.
139+
2. Set `razor.languageServer.directory` to the path of your Razor DLL.
140+
3. Enable `razor.languageServer.debug`.
141+
4. Set `razor.server.trace` to `Debug`. This gives you more detailed log messages in the output window.
43142

44-
### Creating VSIXs
143+
## Creating VSIX Packages for the Extension
45144

46-
VSIXs can be created using the gulp command `gulp vsix:release:package`. This will create all the platform specific VSIXs that you can then install manually in VSCode.
145+
To package this extension, we need to create VSIX Packages. The VSIX packages can be created using the gulp command `gulp vsix:release:package`. This will create all the platform specific VSIXs that you can then install manually in VSCode.
47146

48-
## Updating the Roslyn server version
147+
## Updating the `Roslyn` Language Server Version
49148

50149
To update the version of the roslyn server used by the extension do the following:
51150
1. Find the the Roslyn signed build you want from [here](https://dnceng.visualstudio.com/internal/_build?definitionId=327&_a=summary). Typically the latest successful build of main is fine.
52-
2. In the official build stage, look for the `Publish Assets` step. In there you will see it publishing the `Microsoft.CodeAnalysis.LanguageServer` package with some version, e.g. `4.6.0-3.23158.4`. Take note of that version number.
151+
2. In the official build stage, look for the `Publish Assets` step. In there you will see it publishing the `Microsoft.CodeAnalysis.LanguageServer.neutral` package with some version, e.g. `4.6.0-3.23158.4`. Take note of that version number.
53152
3. In the [package.json](package.json) inside the `defaults` section update the `roslyn` key to point to the version number you found above in step 2.
54-
4. Build and test the change (make sure to run `gulp installDependencies` to get the new version!). If everything looks good, submit a PR.
55-
* Adding new package versions might require authentication, run with the `--interactive` flag to login. You may need to install [azure artifacts nuget credential provider](https://github.com/microsoft/artifacts-credprovider#installation-on-windows) to run interactive authentication.
153+
4. Ensure that version of the package is in the proper feeds by running `gulp updateRoslynVersion`. Note: you may need to install the [Azure Artifacts NuGet Credential Provider](https://github.com/microsoft/artifacts-credprovider#installation-on-windows) to run interactive authentication.
154+
5. Build and test the change. If everything looks good, submit a PR.

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ While it is possible to use the C# extension as a standalone extension, we highl
66

77
1. Installing [C# Dev Kit][csdevkitextension] will automatically install this extension as a required dependency.
88
2. Open a folder/workspace that contains a C# project (.csproj) and a C# solution (.sln) and the extension will activate.
9-
3. Whether you install C# Dev Kit or just the C# extension, the [.NET Runtime Installer Tool extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-runtime) will be installed as a dependency.
9+
3. Whether you install C# Dev Kit or just the C# extension, the [.NET Install Tool](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscode-dotnet-runtime) will be installed as a dependency.
1010

11-
Note: If working on a solution that requires versions prior to .NET 6 or non-solution based projects, install a Full Framework runtime and [MSBuild tooling](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022).
11+
Note: If working on a solution that requires versions prior to .NET 6 or non-solution based projects, install a .NET Framework runtime and [MSBuild tooling](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022).
1212
* Set omnisharp.useModernNet to false and set dotnet.server.useOmnisharp to true
1313
* Uninstall or disable C# Dev Kit
1414
* Windows: .NET Framework along with [MSBuild Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022)
@@ -29,11 +29,20 @@ For more information you can:
2929
## How to use OmniSharp?
3030
If you don’t want to take advantage of the great Language Server features, you can revert back to using OmniSharp by going to the Extension settings and setting `dotnet.server.useOmnisharp` to true. Next, uninstall or disable C# Dev Kit. Finally, restart VS Code for this to take effect.
3131

32-
3332
## Found a Bug?
34-
To file a new issue to include all the related config information directly from vscode by entering the command pallette with Ctrl+Shift+P (Cmd+Shift+P on macOS) and running CSharp: Report an issue command. This will open a browser window with all the necessary information related to the installed extensions, dotnet version, mono version, etc. Enter all the remaining information and hit submit.
35-
Alternatively you could visit https://github.com/dotnet/vscode-csharp/issues and file a new one.
36-
33+
To file a new issue:
34+
35+
1. Open the Command Palette with Ctrl+Shift+P (Cmd+Shift+P on macOS), type "Open Settings (UI)", and press Enter.
36+
2. Search for "trace" in the search bar. Under "Dotnet > Server: Trace" select "Trace" from the drop down. This will provide more output information.
37+
3. Reload the window by opening the Command Palette with Ctrl+Shift+P (Cmd+Shift+P on macOS), type "Reload Window", and press Enter.
38+
4. Next, check the C# logs in the Output Window by opening it with Ctrl+Shift+U (Cmd+Shift+U on macOS), and select C# from the dropdown.
39+
5. Select and copy all the text in the log, and then report the issue through VS Code.
40+
6. Open the Command Palette with Ctrl+Shift+P (Cmd+Shift+P on macOS), type “CSharp: Report an issue”, and press Enter.
41+
7. This will open a window with all the necessary information related to the C# extension, dotnet version, mono version, etc.
42+
8. Paste the previously copied C# log into the “Steps to Reproduce” field. Please also include a description of what you were doing/attempting to do at the time the problem occurred.
43+
9. Click the “Preview on GitHub” button, and then file the issue.
44+
45+
Alternatively, you could visit https://github.com/dotnet/vscode-csharp/issues and file a new issue there.
3746

3847
## Contributing
3948

0 commit comments

Comments
 (0)