diff --git a/New_Extensibility_Model/Samples/CodeLensSample/ClickCountCodeLensProvider.cs b/New_Extensibility_Model/Samples/CodeLensSample/ClickCountCodeLensProvider.cs
new file mode 100644
index 00000000..9ff79ba0
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/ClickCountCodeLensProvider.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Extensibility;
+using Microsoft.VisualStudio.Extensibility.Editor;
+
+///
+/// A sample CodeLens provider that provides invokable CodeLens and shows the number of times it has been clicked.
+///
+#pragma warning disable VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
+[VisualStudioContribution]
+internal class ClickCountCodeLensProvider : ExtensionPart, ICodeLensProvider
+{
+ public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
+ {
+ AppliesTo = new[]
+ {
+ DocumentFilter.FromDocumentType(DocumentType.KnownValues.Code),
+ },
+ };
+
+#pragma warning disable CEE0027 // String not localized
+ public CodeLensProviderConfiguration CodeLensProviderConfiguration =>
+ new("Invokable CodeLens Sample Provider")
+ {
+ Priority = 500,
+ };
+#pragma warning restore CEE0027 // String not localized
+
+ public Task TryCreateCodeLensAsync(CodeElement codeElement, CodeElementContext codeElementContext, CancellationToken token)
+ {
+ if (codeElement.Kind == CodeElementKind.KnownValues.Method)
+ {
+ return Task.FromResult(new ClickableCodeLens(codeElement, this.Extensibility));
+ }
+
+ return Task.FromResult(null);
+ }
+}
+#pragma warning restore VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/ClickableCodeLens.cs b/New_Extensibility_Model/Samples/CodeLensSample/ClickableCodeLens.cs
new file mode 100644
index 00000000..5dc94161
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/ClickableCodeLens.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Extensibility;
+using Microsoft.VisualStudio.Extensibility.Editor;
+
+#pragma warning disable VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
+internal class ClickableCodeLens : InvokableCodeLens
+{
+ private readonly CodeElement codeElement;
+ private readonly VisualStudioExtensibility extensibility;
+ private int clickCount;
+
+ public ClickableCodeLens(CodeElement codeElement, VisualStudioExtensibility extensibility)
+ {
+ this.codeElement = codeElement;
+ this.extensibility = extensibility;
+ }
+
+ public override void Dispose()
+ {
+ }
+
+ public override Task ExecuteAsync(CodeElementContext codeElementContext, IClientContext clientContext, CancellationToken cancelToken)
+ {
+ this.clickCount++;
+ this.Invalidate();
+ return Task.CompletedTask;
+ }
+
+ public override Task GetLabelAsync(CodeElementContext codeElementContext, CancellationToken token)
+ {
+ return Task.FromResult(new CodeLensLabel()
+ {
+ Text = this.clickCount == 0 ? "Click me" : $"Clicked {this.clickCount} times",
+ Tooltip = "Invokable CodeLens Sample Tooltip",
+ });
+ }
+}
+#pragma warning restore VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/CodeLensSample.csproj b/New_Extensibility_Model/Samples/CodeLensSample/CodeLensSample.csproj
new file mode 100644
index 00000000..305286a6
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/CodeLensSample.csproj
@@ -0,0 +1,17 @@
+
+
+ net8.0-windows8.0
+ enable
+ 12
+ en-US
+
+
+
+
+
+
+
+
+
+
+
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/ExtensionEntrypoint.cs b/New_Extensibility_Model/Samples/CodeLensSample/ExtensionEntrypoint.cs
new file mode 100644
index 00000000..d541a21d
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/ExtensionEntrypoint.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using Microsoft.VisualStudio.Extensibility;
+
+///
+/// A sample demonstrating how to extend CodeLens.
+///
+[VisualStudioContribution]
+internal class ExtensionEntrypoint : Extension
+{
+ ///
+ public override ExtensionConfiguration ExtensionConfiguration => new()
+ {
+ Metadata = new(
+ "C43CCA96-C391-42B0-95A5-5B1090909605.CodeLensSample",
+ this.ExtensionAssemblyVersion,
+ "Microsoft",
+ "Codelens Sample",
+ "Sample extension demonstrating the CodeLens capabilities."),
+ };
+}
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/README.md b/New_Extensibility_Model/Samples/CodeLensSample/README.md
new file mode 100644
index 00000000..b35467d4
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/README.md
@@ -0,0 +1,137 @@
+---
+title: Code Lens Sample Reference
+description: A reference for Code Lens Sample
+date: 2023-10-14
+---
+
+# Walkthrough: Code Lens Sample
+
+This extension is a sample extension which contributes two Code Lens providers - one that provides clickable Code Lens displaying number of times user clicked on it and another that provides Code Lens displaying the number of words in a method and custom UI displayed when user clicks on the Code Lens. It is a good starting point for learning how to create a Code Lens provider.
+
+## ClickCountCodeLensProvider and ClickableCodeLens
+
+`ClickCountCodeLensProvider` is a part of the extension that provides an invokable Code Lens that allows execution by user clicking on it and indicating number of times it was executed.
+
+`ClickCountCodeLensProvider` utilizes the `AppliesTo` configuration to indicate that it is interested in events from text views whose documents are of `DocumentType.KnownValues.Code`, which are all text based documents containing code.
+
+```csharp
+///
+public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
+{
+ AppliesTo = new[]
+ {
+ DocumentFilter.FromDocumentType(DocumentType.KnownValues.Code),
+ },
+};
+```
+
+`ClickCountCodeLensProvider` utilizes the `CodeLensProviderConfiguration` to declare its display name and that the Code Lens it provides should be placed after other existing Code Lenses with a priority of 500.
+
+```csharp
+ public CodeLensProviderConfiguration CodeLensProviderConfiguration =>
+ new("Invokable CodeLens Sample Provider")
+ {
+ Priority = 500,
+ };
+```
+
+When requested, `ClickCountCodeLensProvider` provides a `ClickableCodeLens` instance:
+
+```csharp
+public Task TryCreateCodeLensAsync(CodeElement codeElement, CodeElementContext codeElementContext, CancellationToken token)
+{
+ if (codeElement.Kind == CodeElementKind.KnownValues.Method)
+ {
+ return Task.FromResult(new ClickableCodeLens(codeElement, this.Extensibility));
+ }
+
+ return Task.FromResult(null);
+}
+```
+
+`ClickableCodeLens` provides `CodeLensLabel` that is being displayed above methods and implements `InvokableCodeLens` abstract class to increment click count on each invocation.
+```csharp
+public override Task ExecuteAsync(CodeElementContext codeElementContext, IClientContext clientContext, CancellationToken cancelToken)
+{
+ this.clickCount++;
+ this.Invalidate();
+ return Task.CompletedTask;
+}
+
+public override Task GetLabelAsync(CodeElementContext codeElementContext, CancellationToken token)
+{
+ return Task.FromResult(new CodeLensLabel()
+ {
+ Text = this.clickCount == 0 ? "Click me" : $"Clicked {this.clickCount} times",
+ Tooltip = "Invokable CodeLens Sample Tooltip",
+ });
+}
+```
+
+## WordCountCodeLensProvider and WordCountCodeLens
+
+`WordCountCodeLensProvider` is a part of the extension that provides a visual Code Lens indicating number of words in a method body and that listens for new editor text view creation and changes to open text views to update the word count.
+
+`WordCountCodeLensProvider` utilizes the `AppliesTo` configuration to indicate that it is interested in events from text views whose documents are of `DocumentType.KnownValues.Code`, which are all text based documents containing code.
+
+```csharp
+///
+public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
+{
+ AppliesTo = new[]
+ {
+ DocumentFilter.FromDocumentType(DocumentType.KnownValues.Code),
+ },
+};
+```
+
+`WordCountCodeLensProvider` utilizes the `CodeLensProviderConfiguration` to declare its display name and that the Code Lens it provides should be placed after other existing Code Lenses with a priority of 500.
+
+```csharp
+ public CodeLensProviderConfiguration CodeLensProviderConfiguration =>
+ new("Invokable CodeLens Sample Provider")
+ {
+ Priority = 500,
+ };
+```
+
+When requested, `WordCountCodeLensProvider` provides `WordCountCodeLens` instance:
+
+```csharp
+public Task TryCreateCodeLensAsync(CodeElement codeElement, CodeElementContext codeElementContext, CancellationToken token)
+{
+ if (codeElement.Kind == CodeElementKind.KnownValues.Method || codeElement.Kind.IsOfKind(CodeElementKind.KnownValues.Type))
+ {
+ return Task.FromResult(new WordCountCodeLens(codeElement, codeElementContext, this.Extensibility, this));
+ }
+
+ return Task.FromResult(null);
+}
+```
+
+`WordCountCodeLens` provides `CodeLensLabel` that is being displayed above methods and implements `VisualCodeLens` to provide custom UI displayed when user clicks on the Code Lens.
+
+```csharp
+public override Task GetLabelAsync(CodeElementContext codeElementContext, CancellationToken token)
+{
+ this.wordCountData.WordCount = CountWords(codeElementContext.Range);
+ return Task.FromResult(new CodeLensLabel()
+ {
+ Text = $"Words: {this.wordCountData.WordCount}",
+ Tooltip = "Number of words in this code element",
+ });
+}
+
+public override Task GetVisualizationAsync(CodeElementContext codeElementContext, IClientContext clientContext, CancellationToken token)
+{
+ return Task.FromResult(new WordCountCodeLensVisual(this.wordCountData));
+}
+```
+
+## Usage
+
+Once deployed, the Code Lens Sample will add two Code Lenses displayed above each method, one that can be clicked and displays the number of times it was clicked and another that displays the number of words in the method and provides custom UI displayed when user clicks on the Code Lens.
+
+## See also
+
+- [Use Editor extensibility](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/editor/editor)
\ No newline at end of file
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLens.cs b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLens.cs
new file mode 100644
index 00000000..bfcd99b5
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLens.cs
@@ -0,0 +1,65 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using System;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Extensibility;
+using Microsoft.VisualStudio.Extensibility.Editor;
+using Microsoft.VisualStudio.RpcContracts.RemoteUI;
+
+#pragma warning disable VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
+internal class WordCountCodeLens : VisualCodeLens
+{
+ private readonly WordCountData wordCountData;
+
+ public WordCountCodeLens(CodeElement codeElement, CodeElementContext codeElementContext, VisualStudioExtensibility extensibility, WordCountCodeLensProvider wordCountCodeLensProvider)
+ {
+ this.wordCountData = new WordCountData(this);
+ this.wordCountData.WordCount = this.CountWords(codeElementContext.Range);
+ wordCountCodeLensProvider.TextViewChanged += this.OnTextViewChanged;
+ }
+
+ public override void Dispose()
+ {
+ }
+
+ public override Task GetLabelAsync(CodeElementContext codeElementContext, CancellationToken token)
+ {
+ this.wordCountData.WordCount = this.CountWords(codeElementContext.Range);
+ return Task.FromResult(new CodeLensLabel()
+ {
+ Text = $"Occurrences of \"{this.wordCountData.WordToMatch}\": {this.wordCountData.WordCount}",
+ Tooltip = "Number of occurrences of a word in the text",
+ });
+ }
+
+ public override Task GetVisualizationAsync(CodeElementContext codeElementContext, IClientContext clientContext, CancellationToken token)
+ {
+ return Task.FromResult(new WordCountCodeLensVisual(this.wordCountData, this));
+ }
+
+ internal void UpdateWordCount()
+ {
+ this.Invalidate();
+ }
+
+ private int CountWords(TextRange range)
+ {
+ var rangeText = range.CopyToString();
+ var wordToMatch = this.wordCountData.WordToMatch;
+
+ // Use Regex to find all matches of wordToMatch in rangeText
+ var matches = Regex.Matches(rangeText, $@"\b{Regex.Escape(wordToMatch)}\b", RegexOptions.IgnoreCase);
+ return matches.Count;
+ }
+
+ private void OnTextViewChanged(object? sender, TextViewChangedArgs e)
+ {
+ this.Invalidate();
+ }
+}
+#pragma warning restore VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensProvider.cs b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensProvider.cs
new file mode 100644
index 00000000..ed63c0ed
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensProvider.cs
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Extensibility;
+using Microsoft.VisualStudio.Extensibility.Editor;
+
+///
+/// A sample CodeLens provider that shows the number of words in a method or type and provides custom UI when clicked.
+///
+#pragma warning disable VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
+[VisualStudioContribution]
+internal class WordCountCodeLensProvider : ExtensionPart, ICodeLensProvider, ITextViewChangedListener
+{
+ public event EventHandler? TextViewChanged;
+
+ public TextViewExtensionConfiguration TextViewExtensionConfiguration => new()
+ {
+ AppliesTo = new[]
+ {
+ DocumentFilter.FromDocumentType(DocumentType.KnownValues.Code),
+ },
+ };
+
+#pragma warning disable CEE0027 // String not localized
+ public CodeLensProviderConfiguration CodeLensProviderConfiguration =>
+ new("Remote UI CodeLens Sample Provider")
+ {
+ Priority = 600,
+ };
+#pragma warning restore CEE0027 // String not localized
+
+ public Task TryCreateCodeLensAsync(CodeElement codeElement, CodeElementContext codeElementContext, CancellationToken token)
+ {
+ if (codeElement.Kind == CodeElementKind.KnownValues.Method)
+ {
+ return Task.FromResult(new WordCountCodeLens(codeElement, codeElementContext, this.Extensibility, this));
+ }
+
+ return Task.FromResult(null);
+ }
+
+ public Task TextViewChangedAsync(TextViewChangedArgs args, CancellationToken cancellationToken)
+ {
+ this.TextViewChanged?.Invoke(this, args);
+ return Task.CompletedTask;
+ }
+}
+#pragma warning restore VSEXTPREVIEW_CODELENS // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.cs b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.cs
new file mode 100644
index 00000000..dced4dcd
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using Microsoft.VisualStudio.Extensibility.UI;
+
+internal class WordCountCodeLensVisual : RemoteUserControl
+{
+ private readonly WordCountCodeLens wordCountCodeLens;
+
+ public WordCountCodeLensVisual(object? dataContext, WordCountCodeLens wordCountCodeLens)
+ : base(dataContext)
+ {
+ this.wordCountCodeLens = wordCountCodeLens;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+ this.wordCountCodeLens.UpdateWordCount();
+ }
+}
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.xaml b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.xaml
new file mode 100644
index 00000000..11dc6627
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/WordCountCodeLensVisual.xaml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ Number of occurrences of word "":
+
+
+
+ Enter new word:
+
+
+
+
+
\ No newline at end of file
diff --git a/New_Extensibility_Model/Samples/CodeLensSample/WordCountData.cs b/New_Extensibility_Model/Samples/CodeLensSample/WordCountData.cs
new file mode 100644
index 00000000..fddc52bc
--- /dev/null
+++ b/New_Extensibility_Model/Samples/CodeLensSample/WordCountData.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace CodeLensSample;
+
+using System.Runtime.Serialization;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Extensibility.UI;
+
+[DataContract]
+internal class WordCountData : NotifyPropertyChangedObject
+{
+ private readonly WordCountCodeLens wordCountCodeLens;
+ private int wordCount;
+ private string wordToMatch = "return";
+ private string newWordToMatch = string.Empty;
+
+ public WordCountData(WordCountCodeLens wordCountCodeLens)
+ {
+ this.CountWordsCommand = new AsyncCommand(this.CountWordsAsync);
+ this.wordCountCodeLens = wordCountCodeLens;
+ }
+
+ [DataMember]
+ public int WordCount
+ {
+ get => this.wordCount;
+ set => this.SetProperty(ref this.wordCount, value);
+ }
+
+ [DataMember]
+ public string WordToMatch
+ {
+ get => this.wordToMatch;
+ set => this.SetProperty(ref this.wordToMatch, value);
+ }
+
+ [DataMember]
+ public string NewWordToMatch
+ {
+ get => this.newWordToMatch;
+ set => this.SetProperty(ref this.newWordToMatch, value);
+ }
+
+ [DataMember]
+ public IAsyncCommand CountWordsCommand
+ {
+ get;
+ }
+
+ private Task CountWordsAsync(object? commandParameter, CancellationToken cancellationToken)
+ {
+ this.WordToMatch = this.newWordToMatch;
+ this.wordCountCodeLens.UpdateWordCount();
+ return Task.CompletedTask;
+ }
+}
diff --git a/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj b/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
index 76abe4b1..a709fbba 100644
--- a/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
+++ b/New_Extensibility_Model/Samples/CommandParentingSample/CommandParentingSample.csproj
@@ -11,7 +11,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj b/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
index 871330b1..9f4942d7 100644
--- a/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
+++ b/New_Extensibility_Model/Samples/CommentRemover/CommentRemover.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj b/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
index 87d44d72..a30542c1 100644
--- a/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
+++ b/New_Extensibility_Model/Samples/DialogSample/DialogSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj b/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
index ef4c794f..54cf2366 100644
--- a/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
+++ b/New_Extensibility_Model/Samples/DocumentSelectorSample/DocumentSelectorSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/DocumentSelectorSample/UnitTestRunner.cs b/New_Extensibility_Model/Samples/DocumentSelectorSample/UnitTestRunner.cs
index f5dc19be..1d3d1fd5 100644
--- a/New_Extensibility_Model/Samples/DocumentSelectorSample/UnitTestRunner.cs
+++ b/New_Extensibility_Model/Samples/DocumentSelectorSample/UnitTestRunner.cs
@@ -5,7 +5,6 @@ namespace DocumentSelectorSample;
using System.Threading;
using System.Threading.Tasks;
-using Microsoft;
using Microsoft.VisualStudio.Extensibility;
using Microsoft.VisualStudio.Extensibility.Documents;
using Microsoft.VisualStudio.Extensibility.Editor;
@@ -19,7 +18,7 @@ namespace DocumentSelectorSample;
[VisualStudioContribution]
internal class UnitTestRunner : ExtensionPart, ITextViewOpenClosedListener, ITextViewChangedListener
{
- private OutputWindow? outputWindow;
+ private OutputChannel? outputChannel;
///
/// Initializes a new instance of the class.
@@ -62,7 +61,7 @@ public Task TextViewClosedAsync(ITextViewSnapshot textViewSnapshot, Cancellation
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
- this.outputWindow?.Dispose();
+ this.outputChannel?.Dispose();
}
private async Task RunUnitTestsAfterDelayAsync(ITextViewSnapshot textViewSnapshot, CancellationToken cancellationToken)
@@ -76,19 +75,12 @@ private async Task StopUnitTestsAsync(ITextViewSnapshot textViewSnapshot, Cancel
await this.WriteToOutputWindowAsync($"Stop running unit tests in {textViewSnapshot.Document.Uri.LocalPath}", cancellationToken);
}
- private async Task GetOutputWindowAsync(CancellationToken cancellationToken)
- {
- return this.outputWindow ??= await this.Extensibility.Views().Output.GetChannelAsync(
- identifier: nameof(DocumentSelectorSample),
- displayNameResourceId: nameof(Resources.OutputWindowPaneName),
- cancellationToken);
- }
-
private async Task WriteToOutputWindowAsync(string message, CancellationToken cancellationToken)
{
- var channel = await this.GetOutputWindowAsync(cancellationToken);
- Assumes.NotNull(channel);
- await channel.Writer.WriteLineAsync(message);
+ this.outputChannel ??= await this.Extensibility.Views().Output.CreateOutputChannelAsync(
+ Resources.OutputWindowPaneName,
+ cancellationToken);
+ await this.outputChannel.WriteLineAsync(message);
}
}
#pragma warning restore VSEXTPREVIEW_OUTPUTWINDOW // Type is for evaluation purposes only and is subject to change or removal in future updates.
diff --git a/New_Extensibility_Model/Samples/ExtensionPublisher/ExtensionPublisher.csproj b/New_Extensibility_Model/Samples/ExtensionPublisher/ExtensionPublisher.csproj
index 05376d29..0f3b98cd 100644
--- a/New_Extensibility_Model/Samples/ExtensionPublisher/ExtensionPublisher.csproj
+++ b/New_Extensibility_Model/Samples/ExtensionPublisher/ExtensionPublisher.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/FeatureGallery/FeatureGallery.csproj b/New_Extensibility_Model/Samples/FeatureGallery/FeatureGallery.csproj
index 6679f3f4..7b2d7d34 100644
--- a/New_Extensibility_Model/Samples/FeatureGallery/FeatureGallery.csproj
+++ b/New_Extensibility_Model/Samples/FeatureGallery/FeatureGallery.csproj
@@ -6,8 +6,8 @@
en-US
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/FilePickerSample/FilePickerSample.csproj b/New_Extensibility_Model/Samples/FilePickerSample/FilePickerSample.csproj
index f5acf606..34699464 100644
--- a/New_Extensibility_Model/Samples/FilePickerSample/FilePickerSample.csproj
+++ b/New_Extensibility_Model/Samples/FilePickerSample/FilePickerSample.csproj
@@ -7,7 +7,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/InProcFeatureGallery/InProcFeatureGallery.csproj b/New_Extensibility_Model/Samples/InProcFeatureGallery/InProcFeatureGallery.csproj
index bd57581c..f8c01fe5 100644
--- a/New_Extensibility_Model/Samples/InProcFeatureGallery/InProcFeatureGallery.csproj
+++ b/New_Extensibility_Model/Samples/InProcFeatureGallery/InProcFeatureGallery.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj b/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
index 5e1b5ca1..fe5d101e 100644
--- a/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
+++ b/New_Extensibility_Model/Samples/InsertGuid/InsertGuid.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownDiagnosticsService.cs b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownDiagnosticsService.cs
index b867d20c..7070eedf 100644
--- a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownDiagnosticsService.cs
+++ b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownDiagnosticsService.cs
@@ -28,7 +28,7 @@ internal class MarkdownDiagnosticsService : DisposableObject
#pragma warning restore CA2213 // Disposable fields should be disposed
private readonly Dictionary documentCancellationTokens;
private readonly Task initializationTask;
- private OutputWindow? outputWindow;
+ private OutputChannel? outputChannel;
private DiagnosticsReporter? diagnosticsReporter;
///
@@ -78,9 +78,9 @@ public async Task ProcessFileAsync(Uri documentUri, CancellationToken cancellati
}
catch (InvalidOperationException)
{
- if (this.outputWindow is not null)
+ if (this.outputChannel is not null)
{
- await this.outputWindow.Writer.WriteLineAsync(Strings.MissingLinterError);
+ await this.outputChannel.WriteLineAsync(Strings.MissingLinterError);
}
}
}
@@ -134,7 +134,7 @@ protected override void Dispose(bool isDisposing)
if (isDisposing)
{
- this.outputWindow?.Dispose();
+ this.outputChannel?.Dispose();
this.diagnosticsReporter?.Dispose();
}
}
@@ -158,18 +158,16 @@ private async Task ProcessDocumentAsync(ITextDocumentSnapshot documentSnapshot,
}
catch (InvalidOperationException)
{
- if (this.outputWindow is not null)
+ if (this.outputChannel is not null)
{
- await this.outputWindow.Writer.WriteLineAsync(Strings.MissingLinterError);
+ await this.outputChannel.WriteLineAsync(Strings.MissingLinterError);
}
}
}
private async Task InitializeAsync()
{
- this.outputWindow = await this.extensibility.Views().Output.GetChannelAsync(nameof(MarkdownLinterExtension) + Guid.NewGuid(), nameof(Strings.MarkdownLinterWindowName), default);
- Assumes.NotNull(this.outputWindow);
-
+ this.outputChannel = await this.extensibility.Views().Output.CreateOutputChannelAsync(Strings.MarkdownLinterWindowName, default);
this.diagnosticsReporter = this.extensibility.Languages().GetDiagnosticsReporter(nameof(MarkdownLinterExtension));
Assumes.NotNull(this.diagnosticsReporter);
}
diff --git a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
index 4e570f76..2befa01a 100644
--- a/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
+++ b/New_Extensibility_Model/Samples/MarkdownLinter/MarkdownLinter.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj b/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
index ebe31a6c..f339d754 100644
--- a/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
+++ b/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer/MemoryStreamVisualizer/MemoryStreamVisualizer.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj b/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
index 5457c0c0..632e3850 100644
--- a/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
+++ b/New_Extensibility_Model/Samples/OutputWindowSample/OutputWindowSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/OutputWindowSample/TestOutputWindowCommand.cs b/New_Extensibility_Model/Samples/OutputWindowSample/TestOutputWindowCommand.cs
index 05eea10b..7a17dbe4 100644
--- a/New_Extensibility_Model/Samples/OutputWindowSample/TestOutputWindowCommand.cs
+++ b/New_Extensibility_Model/Samples/OutputWindowSample/TestOutputWindowCommand.cs
@@ -16,7 +16,7 @@ namespace OutputWindowSample;
#pragma warning disable VSEXTPREVIEW_OUTPUTWINDOW // Type is for evaluation purposes only and is subject to change or removal in future updates.
public class TestOutputWindowCommand : Command
{
- private OutputWindow? outputWindow;
+ private OutputChannel? outputChannel;
///
public override CommandConfiguration CommandConfiguration => new("%OutputWindowSample.TestOutputWindowCommand.DisplayName%")
@@ -28,24 +28,17 @@ public class TestOutputWindowCommand : Command
///
public override async Task InitializeAsync(CancellationToken cancellationToken)
{
- this.outputWindow = await this.GetOutputWindowAsync(cancellationToken);
+ this.outputChannel = await this.Extensibility.Views().Output.CreateOutputChannelAsync(Strings.OutputWindowDisplayName, cancellationToken);
await base.InitializeAsync(cancellationToken);
}
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- if (this.outputWindow != null)
+ if (this.outputChannel != null)
{
- await this.outputWindow.Writer.WriteLineAsync("This is a test of the output window.");
+ await this.outputChannel.WriteLineAsync("This is a test of the output window.");
}
}
-
- private async Task GetOutputWindowAsync(CancellationToken cancellationToken)
- {
- string id = "MyOutputWindow";
- string displayNameResourceId = nameof(Strings.OutputWindowDisplayName);
- return await this.Extensibility.Views().Output.GetChannelAsync(id, displayNameResourceId, cancellationToken);
- }
}
#pragma warning restore VSEXTPREVIEW_OUTPUTWINDOW // Type is for evaluation purposes only and is subject to change or removal in future updates.
diff --git a/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj b/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
index 5d48f24e..44ae6a8a 100644
--- a/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
+++ b/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer/RegexMatchDebugVisualizer.csproj
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
index 0120adfb..6c04e681 100644
--- a/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
+++ b/New_Extensibility_Model/Samples/RustLanguageServerProvider/RustLanguageServerProvider.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/Samples.sln b/New_Extensibility_Model/Samples/Samples.sln
index 8376b913..0937f607 100644
--- a/New_Extensibility_Model/Samples/Samples.sln
+++ b/New_Extensibility_Model/Samples/Samples.sln
@@ -55,6 +55,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtensionPublisher", "Exten
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilePickerSample", "FilePickerSample\FilePickerSample.csproj", "{626939FA-4B8B-484E-BFD9-32DDFAFA472E}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsSample", "SettingsSample\SettingsSample.csproj", "{0D0B8CBF-CEAB-4956-87C8-96B931E5458C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeLensSample", "CodeLensSample\CodeLensSample.csproj", "{B0DDBB39-51C3-4B3C-A327-C93C867E3B4B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -145,6 +149,16 @@ Global
{626939FA-4B8B-484E-BFD9-32DDFAFA472E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{626939FA-4B8B-484E-BFD9-32DDFAFA472E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{626939FA-4B8B-484E-BFD9-32DDFAFA472E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0D0B8CBF-CEAB-4956-87C8-96B931E5458C}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {B0DDBB39-51C3-4B3C-A327-C93C867E3B4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0DDBB39-51C3-4B3C-A327-C93C867E3B4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0DDBB39-51C3-4B3C-A327-C93C867E3B4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0DDBB39-51C3-4B3C-A327-C93C867E3B4B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/New_Extensibility_Model/Samples/SettingsSample/SettingsSample.csproj b/New_Extensibility_Model/Samples/SettingsSample/SettingsSample.csproj
index e8329e55..8d0965ad 100644
--- a/New_Extensibility_Model/Samples/SettingsSample/SettingsSample.csproj
+++ b/New_Extensibility_Model/Samples/SettingsSample/SettingsSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj b/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
index 95f07f02..ab484036 100644
--- a/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
+++ b/New_Extensibility_Model/Samples/SimpleRemoteCommandSample/SimpleRemoteCommandSample.csproj
@@ -7,7 +7,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj b/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
index e8329e55..8d0965ad 100644
--- a/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
+++ b/New_Extensibility_Model/Samples/ToolWindowSample/ToolWindowSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj b/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
index e7e13d64..1633fab2 100644
--- a/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
+++ b/New_Extensibility_Model/Samples/UserPromptSample/UserPromptSample.csproj
@@ -8,7 +8,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
index d0553398..15443920 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/VSProjectQueryAPISample.csproj
@@ -8,7 +8,7 @@
-
-
+
+
diff --git a/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj b/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
index 14bfda7e..5b58105d 100644
--- a/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
+++ b/New_Extensibility_Model/Samples/WordCountMargin/WordCountMarginSample.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/docs/experimental_apis.md b/docs/experimental_apis.md
index 9c8e8d3b..f15eedf3 100644
--- a/docs/experimental_apis.md
+++ b/docs/experimental_apis.md
@@ -51,6 +51,7 @@ As of our 17.9 release, there are three experimental features:
| Feature | Label | Description |
|---------|-------|-------------|
| LSP | VSEXTPREVIEW_LSP | LSP support was added with our 17.9 release and we want user feedback to make sure we've got the features needed by extension authors.|
-| Output Window | VSEXTPREVIEW_OUTPUTWINDOW | We're updating our output window APIs based on user feedback to provide a simplified way to write to the output window. |
+| Output Window | VSEXTPREVIEW_OUTPUTWINDOW | We'updated our output window APIs with our 17.12 release and would like user feedback to see if this could be the final shape. |
| Project Query Tracking | VSEXTPREVIEW_PROJECTQUERY_TRACKING | We're continuing to update our project query API to add new features|
| Project Query Properties and Build Properties | VSEXTPREVIEW_PROJECTQUERY_PROPERTIES_BUILDPROPERTIES | We're continuing to update our project query API to address user feedback and add new features |
+| Code lens | VSEXTPREVIEW_CODELENS | Code lens support was added in our 17.12 release and we want user feedback to make sure we've got the features needed by extension authors. |
diff --git a/docs/known_issues.md b/docs/known_issues.md
index 92276798..a573da89 100644
--- a/docs/known_issues.md
+++ b/docs/known_issues.md
@@ -12,7 +12,7 @@ This is a list of known issues with VisualStudio.Extensibility. We'll keep this
We've found a bug that prevents fully out-of-process VisualStudio.Extensibility extensions from installing on ARM64 systems. In the meantime, you could structure your extension as an [in-proc/VSSDK-compatible extension](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/get-started/in-proc-extensions) if you need ARM64 compatability.
-**A fix for this issue will soon be available in an upcoming Visual Studio release.**
+**This issue is now fixed with Visual Studio 17.12 release.**
*Last updated on 09-September-2024*
@@ -24,4 +24,4 @@ We've discovered that if you have a Language Pack installed with Visual Studio,
**This issue is now fixed with Visual Studio 17.11 release.**
-*Last updated on 05-September-2024*
\ No newline at end of file
+*Last updated on 10-25-2024*
\ No newline at end of file