First install:
- Node.js (v18.17.0 LTS is recommended).
- Npm (The version shipped with node is fine)
- .NET 7.0 SDK (dotnet should be on your path)
To run and develop the extension do the following:
- Run
npm i
- Run
npm i -g gulp
- Run
gulp installDependencies
(this will download the various dependencies as specified by the version in the package.json) - Open in Visual Studio Code (
code .
) - Optional: run
npm run watch
, make code changes - Press F5 to debug
To test do the following: npm run test
or F5 in VS Code with the "Launch Tests" debug configuration.
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
$roslynRepoRoot/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer/Debug/net7.0/Microsoft.CodeAnalysis.LanguageServer.dll
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.
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.
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
$razorRepoRoot/artifacts/bin/rzls/Debug/net7.0
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.
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.server.trace
to Debug
to get more log messages in the output window
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.
To update the version of the roslyn server used by the extension do the following:
- Find the the Roslyn signed build you want from here. Typically the latest successful build of main is fine.
- In the official build stage, look for the
Publish Assets
step. In there you will see it publishing theMicrosoft.CodeAnalysis.LanguageServer.neutral
package with some version, e.g.4.6.0-3.23158.4
. Take note of that version number. - In the package.json inside the
defaults
section update theroslyn
key to point to the version number you found above in step 2. - 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 to run interactive authentication. - Build and test the change. If everything looks good, submit a PR.