Skip to content

Commit 1218920

Browse files
committed
Include instruction to manually change settings.json
1 parent 90838fa commit 1218920

File tree

1 file changed

+49
-14
lines changed

1 file changed

+49
-14
lines changed

CONTRIBUTING.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
- [Setting Up Local Language Servers](#setting-up-local-language-servers)
77
- [Roslyn](#roslyn)
88
- [Razor](#razor)
9-
- [Debugging Local Language Servers](#debugging-local-language-servers)
9+
- [Configuring Local Language Servers](#configuring-local-language-servers)
1010
- [Roslyn](#roslyn-1)
1111
- [Razor](#razor-1)
12-
- [Creating VSIX Packages for the Extension](#creating-vsix-packages-for-the-extension)
12+
- [Debugging Local Language Servers](#debugging-local-language-servers)
13+
- [Creating VSIX Packages for the Extension](#creating-vsix-packages-for-the-extension)
1314
- [Updating the `Roslyn` Language Server Version](#updating-the-roslyn-language-server-version)
1415

1516
## Setting Up Local Development Environment
@@ -83,26 +84,60 @@ After building, you can find the server DLL in the build output directory. The t
8384

8485
Similar to Roslyn, after building, the server DLL will be in the build output directory. The typical location is `$razorRepoRoot/artifacts/bin/rzls/Debug/net8.0`, but this may vary based on the built configuration.
8586

86-
### Debugging Local Language Servers
87+
### Configuring Local Language Servers
8788

88-
This section provides instructions on how to debug locally developed Roslyn and Razor language servers.
89+
This section provides instructions on how to debug locally developed Roslyn and Razor language servers. You can do this by either directly editing the `settings.json` file or through the VSCode settings interface.
8990

9091
#### Roslyn
9192

92-
1. Open the VSCode settings by using the shortcut `Ctrl+,`.
93-
2. Enter `dotnet server` in the search box to display Roslyn-related settings.
94-
3. Update the `dotnet.server.path` setting to the path of the Roslyn DLL you built earlier, then restart the language server.
95-
4. If you need to debug the server, enable the `dotnet.server.waitForDebugger` setting. This action triggers a `Debugger.Launch()` on the server side when it starts.
93+
1. Navigate to `C:\Users\YourUsername\AppData\Roaming\Code\User\settings.json` and add the following lines:
94+
95+
```json
96+
"dotnet.server.waitForDebugger": true,
97+
"dotnet.server.path": "$roslynRepoRoot\\artifacts\\bin\\Microsoft.CodeAnalysis.LanguageServer\\Debug\\net8.0\\Microsoft.CodeAnalysis.LanguageServer.dll"
98+
```
99+
100+
Replace `$roslynRepoRoot` and `YourUsername` with your actual values.
101+
102+
Or, in VSCode settings (`Ctrl+,`):
103+
104+
1. Search for `dotnet server`.
105+
2. Set `dotnet.server.path` to the path of your Roslyn DLL.
106+
3. Enable `dotnet.server.waitForDebugger`.
96107

97108
#### Razor
98109

99-
1. Open the VSCode settings by using the shortcut `Ctrl+,`.
100-
2. Enter `Razor` in the search box to display Razor-related settings.
101-
3. Update the `razor.languageServer.directory` setting to the path of the Razor DLL you built earlier, then restart the language server.
102-
4. If you need to debug the server, enable the `razor.languageServer.debug` setting. This action triggers a `Debugger.Launch()` on the server side when it starts.
103-
5. For more detailed log messages in the output window, set `razor.server.trace` to `Debug`.
110+
1. Navigate to `C:\Users\YourUsername\AppData\Roaming\Code\User\settings.json` and add the following lines:
111+
112+
```json
113+
"razor.languageServer.debug": true,
114+
"razor.languageServer.directory": "$razorRepoRoot\\artifacts\\bin\\rzls\\Debug\\net8.0",
115+
"razor.server.trace": "Debug"
116+
```
117+
118+
Replace `$razorRepoRoot` and `YourUsername` with your actual values.
119+
120+
Or, in VSCode settings (`Ctrl+,`):
121+
122+
1. Search for `Razor`.
123+
2. Set `razor.languageServer.directory` to the path of your Razor DLL.
124+
3. Enable `razor.languageServer.debug`.
125+
4. Set `razor.server.trace` to `Debug`. This gives you more detailed log messages in the output window.
126+
127+
#### Running Language Servers
128+
129+
You need to follow steps in section [Configuring Local Language Servers](#configuring-local-language-servers) to configure either Roslyn or Razor language servers for debugging first.
130+
131+
Once those steps are complete, then
132+
133+
1. Make sure the language server is fulling built in Debug mode.
134+
2. Preferably open the `.sln` solution file for that language server in a VS instance and set it aside for now. (you will be selecting it in step 5 shortly).
135+
3. `Ctrl+Shift+P` then hit `Reload Window` to make sure these changes take effect.
136+
4. A window immediately pops up prompting you to select or open a VS instance. Ignore this and hit `Cancel`. (This makes sure you don't end up accidentally trying to debug the repo root of vscode-csharp instead. Remember, You only want to debug the child VS code instance that opens up after hitting `F5`.)
137+
5. Hit `Ctrl+Shift+D` and hit `F5` to launch extension. The window from step 4 pops up again, asking you to select or open a VS instance. Select the VS instance you opened in step 2.
138+
6. The language server should now triggers a breakpoint on `Debugger.Launch()` when it starts.
104139

105-
### Creating VSIX Packages for the Extension
140+
## Creating VSIX Packages for the Extension
106141

107142
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.
108143

0 commit comments

Comments
 (0)