diff --git a/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj b/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
index a7b8ab19..b8217d24 100644
--- a/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
+++ b/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
@@ -12,7 +12,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj b/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
index 9f3f42dd..ac0301b7 100644
--- a/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
+++ b/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj b/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
index 464ec957..e8ee001c 100644
--- a/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
+++ b/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj b/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
index 1657200a..2b40ae7d 100644
--- a/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
+++ b/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj b/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
index b6f10ed2..8178fe02 100644
--- a/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
+++ b/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
index 2e33d462..fe60dd6e 100644
--- a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
+++ b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj b/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
index eda10702..c2c40c98 100644
--- a/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
+++ b/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj b/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
index f47b5832..32f098e4 100644
--- a/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
+++ b/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj b/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
index e8bf5842..f23a4281 100644
--- a/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
+++ b/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/RustLanguageServerProvider/README.md b/New_Extensibility_Model/Samples/RustLanguageServerProvider/README.md
index 90963200..a49720f0 100644
--- a/New_Extensibility_Model/Samples/RustLanguageServerProvider/README.md
+++ b/New_Extensibility_Model/Samples/RustLanguageServerProvider/README.md
@@ -16,27 +16,27 @@ This sample requires installing [Rust](https://www.rust-lang.org/tools/install)
The extension contains a code file that defines a language server provider and its properties starting with the `VisualStudioContribution` class attribute which makes the server available to Visual Studio:
```csharp
- [VisualStudioContribution]
- internal class RustLanguageServerProvider : LanguageServerProvider
- {
+[VisualStudioContribution]
+internal class RustLanguageServerProvider : LanguageServerProvider
+{
```
The `LanguageServerProviderConfiguration` property defines information about the server that is available to Visual Studio even before the extension is loaded:
```csharp
- public override LanguageServerProviderConfiguration LanguageServerProviderConfiguration => new(
- "%RustLspExtension.RustLanguageServerProvider.DisplayName%",
- new[]
- {
- DocumentFilter.FromDocumentType(RustDocumentType)
- });
+public override LanguageServerProviderConfiguration LanguageServerProviderConfiguration => new(
+ "%RustLspExtension.RustLanguageServerProvider.DisplayName%",
+ new[]
+ {
+ DocumentFilter.FromDocumentType(RustDocumentType)
+ });
```
This configuration object allows setting the display name for the server and specifying one or more document filters. You can also specify a localized string as a display name from [string-resoures.json](./.vsextension/string-resources.json):
```json
{
- "RustLspExtension.RustLanguageServerProvider.DisplayName": "Rust Analyzer LSP server"
+ "RustLspExtension.RustLanguageServerProvider.DisplayName": "Rust Analyzer LSP server"
}
```
@@ -47,27 +47,27 @@ Once a document that has a matching document type is opened, Visual Studio calls
In our sample, the rust-analyzer executable is launched and a duplex pipe is used to communicate with the process.
```csharp
- public override Task CreateServerConnectionAsync(CancellationToken cancellationToken)
- {
- ProcessStartInfo info = new ProcessStartInfo();
- info.FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, @"rust-analyzer.exe");
- info.RedirectStandardInput = true;
- info.RedirectStandardOutput = true;
- info.UseShellExecute = false;
- info.CreateNoWindow = true;
-
- Process process = new Process();
- process.StartInfo = info;
-
- if (process.Start())
- {
- return Task.FromResult(new DuplexPipe(
- PipeReader.Create(process.StandardOutput.BaseStream),
- PipeWriter.Create(process.StandardInput.BaseStream)));
- }
-
- return Task.FromResult(null);
- }
+public override Task CreateServerConnectionAsync(CancellationToken cancellationToken)
+{
+ ProcessStartInfo info = new ProcessStartInfo();
+ info.FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, @"rust-analyzer.exe");
+ info.RedirectStandardInput = true;
+ info.RedirectStandardOutput = true;
+ info.UseShellExecute = false;
+ info.CreateNoWindow = true;
+
+ Process process = new Process();
+ process.StartInfo = info;
+
+ if (process.Start())
+ {
+ return Task.FromResult(new DuplexPipe(
+ PipeReader.Create(process.StandardOutput.BaseStream),
+ PipeWriter.Create(process.StandardInput.BaseStream)));
+ }
+
+ return Task.FromResult(null);
+}
```
## Disabling the server
@@ -79,16 +79,16 @@ In our sample, the rust-analyzer executable is launched and a duplex pipe is use
After `CreateServerConnectionAsync` completes, Visual Studio will attempt to initialize the server via the provided duplex pipe following standard LSP protocol. Once this step is done, `OnServerInitializationResultAsync` is called where `ServerInitializationResult` denotes if the server succeeded or failed to initialize, and if it failed `LanguageServerInitializationFailureInfo` will contain the exception and message provided by the language server.
```csharp
- public override Task OnServerInitializationResultAsync(ServerInitializationResult serverInitializationResult, LanguageServerInitializationFailureInfo? initializationFailureInfo, CancellationToken cancellationToken)
- {
- if (serverInitializationResult == ServerInitializationResult.Failed)
- {
- // Log telemetry for failure and disable the server from being activated again.
- this.Enabled = false;
- }
-
- return base.OnServerInitializationResultAsync(serverInitializationResult, initializationFailureInfo, cancellationToken);
- }
+public override Task OnServerInitializationResultAsync(ServerInitializationResult serverInitializationResult, LanguageServerInitializationFailureInfo? initializationFailureInfo, CancellationToken cancellationToken)
+{
+ if (serverInitializationResult == ServerInitializationResult.Failed)
+ {
+ // Log telemetry for failure and disable the server from being activated again.
+ this.Enabled = false;
+ }
+
+ return base.OnServerInitializationResultAsync(serverInitializationResult, initializationFailureInfo, cancellationToken);
+}
```
## Usage
diff --git a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.cs b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.cs
index 1fd3a048..4cde003d 100644
--- a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.cs
+++ b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.cs
@@ -4,14 +4,18 @@
namespace RustLanguageServerProviderExtension;
using System.Diagnostics;
+using System.IO;
using System.IO.Pipelines;
using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
using Microsoft.VisualStudio.Extensibility;
using Microsoft.VisualStudio.Extensibility.Editor;
using Microsoft.VisualStudio.Extensibility.LanguageServer;
using Microsoft.VisualStudio.RpcContracts.LanguageServerProvider;
using Nerdbank.Streams;
+#pragma warning disable VSEXTAPI0001 // This API is marked as Preview.
///
[VisualStudioContribution]
internal class RustLanguageServerProvider : LanguageServerProvider
@@ -71,3 +75,4 @@ public override Task OnServerInitializationResultAsync(ServerInitializationResul
return base.OnServerInitializationResultAsync(serverInitializationResult, initializationFailureInfo, cancellationToken);
}
}
+#pragma warning restore VSEXTAPI0001 // This API is marked as Preview.
diff --git a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
index 35c0f9f0..ec08e122 100644
--- a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
+++ b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
@@ -1,21 +1,21 @@
- net8.0-windows
- enable
+ net8.0-windows8.0
enable
- 10
- $(NoWarn);VSEXTAPI0001;
+ 11
+ en-US
+ $(NoWarn);CS1591;CA1812;CA1303;SA1600
https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj b/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
index 92fb4f55..0b8582af 100644
--- a/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
+++ b/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
@@ -11,7 +11,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj b/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
index 57e59316..44ea4419 100644
--- a/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
+++ b/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj b/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
index a5b92ba4..1bda30d7 100644
--- a/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
+++ b/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
@@ -11,7 +11,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
index cc8e5d8e..40a67f8a 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
@@ -12,7 +12,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj b/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
index 8d443174..08a8ed7a 100644
--- a/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
+++ b/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
@@ -11,8 +11,8 @@
-
-
+
+