Updating samples for 17.8 Preview 3 and adding the MemoryStream visualizer sample. (#269)
* Updating samples for 17.8 Preview 3 and adding the MemoryStream visualizer sample. --------- Co-authored-by: Matteo Prosperi <maprospe@microsoft.com>
This commit is contained in:
Родитель
c96946f4ae
Коммит
32384bab00
|
@ -4,7 +4,7 @@
|
|||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NoWarn>SA1633;SA1600;CA1303;CA1016;CA1031;CA1812;$(NoWarn)</NoWarn>
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFrameworks>net472</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NoWarn>SA1633;SA1600;CA1303;CA1016;CA1031;CA1812;$(NoWarn>)</NoWarn>
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.6.36389" ExcludeAssets="runtime" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ using Microsoft.VisualStudio.Extensibility;
|
|||
[VisualStudioContribution]
|
||||
public class CommentRemoverExtension : Extension
|
||||
{
|
||||
public override ExtensionConfiguration? ExtensionConfiguration => new() { RequiresInProcessHosting = true };
|
||||
public override ExtensionConfiguration ExtensionConfiguration => new() { RequiresInProcessHosting = true };
|
||||
|
||||
protected override void InitializeServices(IServiceCollection serviceCollection)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ The extension leverages multiple Visual Studio functionalities that are currenly
|
|||
|
||||
### Creating the extension structure
|
||||
|
||||
I started creating an empty VisualStudio.Extensibility in-proc extension project as described in the [Creating your first in-process VisualStudio.Extensibility extension](../../../docs/new-extensibility-model/getting-started/in-proc-extensions.md) guide.
|
||||
I started creating an empty VisualStudio.Extensibility in-proc extension project as described in the [Creating your first in-process VisualStudio.Extensibility extension](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/get-started/in-proc-extensions) guide.
|
||||
|
||||
I did a quick fix to the `CommentRemoverContainer` project: added the correct information in the [.vsixmanifest](CommentRemoverContainer/source.extension.vsixmanifest) file and added the license file and two image resources that are referenced in the manifest.
|
||||
|
||||
|
@ -105,7 +105,7 @@ You may have noticed that some strings enclosed by `%` characters in the code ab
|
|||
}
|
||||
```
|
||||
|
||||
If we want the extension to be localized for different languages, we can later add `string-resources.json` files for those languages as described [here](../../../docs/new-extensibility-model/extension-guides/command/command.md#string-resourcesjson);
|
||||
If we want the extension to be localized for different languages, we can later add `string-resources.json` files for those languages as described [here](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/command/localize-metadata);
|
||||
|
||||
### Dependency injection of Visual Studio SDK services
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812;CA2007</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -67,14 +67,12 @@ internal class UnitTestRunner : ExtensionPart, ITextViewOpenClosedListener, ITex
|
|||
private async Task RunUnitTestsAfterDelayAsync(ITextViewSnapshot textViewSnapshot, CancellationToken cancellationToken)
|
||||
{
|
||||
await Task.Delay(500, cancellationToken);
|
||||
var document = await textViewSnapshot.GetTextDocumentAsync(cancellationToken);
|
||||
await this.WriteToOutputWindowAsync($"Running unit tests in {document.Uri.LocalPath}", cancellationToken);
|
||||
await this.WriteToOutputWindowAsync($"Running unit tests in {textViewSnapshot.Document.Uri.LocalPath}", cancellationToken);
|
||||
}
|
||||
|
||||
private async Task StopUnitTestsAsync(ITextViewSnapshot textViewSnapshot, CancellationToken cancellationToken)
|
||||
{
|
||||
var document = await textViewSnapshot.GetTextDocumentAsync(cancellationToken);
|
||||
await this.WriteToOutputWindowAsync($"Stop running unit tests in {document.Uri.LocalPath}", cancellationToken);
|
||||
await this.WriteToOutputWindowAsync($"Stop running unit tests in {textViewSnapshot.Document.Uri.LocalPath}", cancellationToken);
|
||||
}
|
||||
|
||||
private async Task<OutputWindow> GetOutputWindowAsync(CancellationToken cancellationToken)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -56,11 +56,10 @@ internal class InsertGuidCommand : Command
|
|||
return;
|
||||
}
|
||||
|
||||
var document = await textView.GetTextDocumentAsync(cancellationToken);
|
||||
await this.Extensibility.Editor().EditAsync(
|
||||
batch =>
|
||||
{
|
||||
document.AsEditable(batch).Replace(textView.Selection.Extent, newGuidString);
|
||||
textView.Document.AsEditable(batch).Replace(textView.Selection.Extent, newGuidString);
|
||||
},
|
||||
cancellationToken);
|
||||
}
|
||||
|
|
|
@ -93,24 +93,18 @@ internal class MarkdownDiagnosticsService : DisposableObject
|
|||
/// <returns>Task indicating completion of reporting markdown errors to error list.</returns>
|
||||
public async Task ProcessTextViewAsync(ITextViewSnapshot textViewSnapshot, CancellationToken cancellationToken)
|
||||
{
|
||||
var document = await textViewSnapshot.GetTextDocumentAsync(cancellationToken);
|
||||
if (document is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CancellationTokenSource newCts = new CancellationTokenSource();
|
||||
lock (this.documentCancellationTokens)
|
||||
{
|
||||
if (this.documentCancellationTokens.TryGetValue(document.Uri, out var cts))
|
||||
if (this.documentCancellationTokens.TryGetValue(textViewSnapshot.Document.Uri, out var cts))
|
||||
{
|
||||
cts.Cancel();
|
||||
}
|
||||
|
||||
this.documentCancellationTokens[document.Uri] = newCts;
|
||||
this.documentCancellationTokens[textViewSnapshot.Document.Uri] = newCts;
|
||||
}
|
||||
|
||||
await this.ProcessDocumentAsync(document, cancellationToken.CombineWith(newCts.Token).Token);
|
||||
await this.ProcessDocumentAsync(textViewSnapshot.Document, cancellationToken.CombineWith(newCts.Token).Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812;CA2007</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -47,13 +47,7 @@ internal class TextViewEventListener : ExtensionPart, ITextViewOpenClosedListene
|
|||
/// <inheritdoc />
|
||||
public async Task TextViewClosedAsync(ITextViewSnapshot textViewSnapshot, CancellationToken cancellationToken)
|
||||
{
|
||||
var document = await textViewSnapshot.GetTextDocumentAsync(cancellationToken);
|
||||
if (document is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await this.diagnosticsProvider.ClearEntriesForDocumentAsync(document.Uri, cancellationToken);
|
||||
await this.diagnosticsProvider.ClearEntriesForDocumentAsync(textViewSnapshot.Document.Uri, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>11</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.6.1032901" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamObjectSource;
|
||||
|
||||
using Microsoft.VisualStudio.DebuggerVisualizers;
|
||||
using System.IO;
|
||||
|
||||
/// <summary>
|
||||
/// Object source class for the MemoryStreamVisualizer.
|
||||
/// </summary>
|
||||
public class MemoryStreamVisualizerObjectSource : VisualizerObjectSource
|
||||
{
|
||||
/// <summary>
|
||||
/// How many rows will be transfered, at most, responding to a single request.
|
||||
/// </summary>
|
||||
public const int RowsCountPerRequest = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// How many bytes will be transfered for each row.
|
||||
/// </summary>
|
||||
public const int RowLength = 16;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void TransferData(object target, Stream incomingData, Stream outgoingData)
|
||||
{
|
||||
if (target is MemoryStream memoryStream)
|
||||
{
|
||||
using BinaryReader binaryReader = new(incomingData);
|
||||
var index = binaryReader.ReadInt32(); // The extension will send the offset (Int32) to start reading from
|
||||
|
||||
using BinaryWriter binaryWriter = new(outgoingData);
|
||||
var backupPosition = memoryStream.Position;
|
||||
|
||||
// Will reply with the current MemoryStream.Position (Int64),
|
||||
// followed by MemoryStream.Length (Int64),
|
||||
// followed by up to 16KB of data retrieved from the MemoryStream
|
||||
binaryWriter.Write(backupPosition);
|
||||
binaryWriter.Write(memoryStream.Length);
|
||||
if (index < memoryStream.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = new byte[RowsCountPerRequest * RowLength];
|
||||
memoryStream.Seek(index, SeekOrigin.Begin);
|
||||
var count = memoryStream.Read(data, 0, data.Length);
|
||||
binaryWriter.Write(data, 0, count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Make sure to restore the MemoryStream to its original position
|
||||
memoryStream.Seek(backupPosition, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
binaryWriter.Flush();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"MemoryStreamVisualizer.MemoryStreamDebuggerVisualizerProvider.Name": "MemoryStream visualizer"
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamVisualizer;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.VisualStudio.Extensibility;
|
||||
|
||||
/// <summary>
|
||||
/// Extension entrypoint for the VisualStudio.Extensibility extension.
|
||||
/// </summary>
|
||||
[VisualStudioContribution]
|
||||
internal class ExtensionEntrypoint : Extension
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override ExtensionConfiguration ExtensionConfiguration => new()
|
||||
{
|
||||
Metadata = new(
|
||||
id: "MemoryStreamVisualizer.97a0a2fb-f163-4fa3-91f0-48a2d4ad9f57",
|
||||
version: this.ExtensionAssemblyVersion,
|
||||
publisherName: "Microsoft",
|
||||
displayName: "MemoryStream Debugger Visualizer"),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeServices(IServiceCollection serviceCollection)
|
||||
{
|
||||
base.InitializeServices(serviceCollection);
|
||||
|
||||
// You can configure dependency injection here by adding services to the serviceCollection.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamVisualizer;
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel class representing a row of binary data.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class HexEditorRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HexEditorRow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of this row.</param>
|
||||
/// <param name="data">The bytes making up this row of data, in their hex representation.</param>
|
||||
/// <param name="ascii">The bytes making up this row of data, in their Ascii representation.</param>
|
||||
public HexEditorRow(int index, string data, string ascii)
|
||||
{
|
||||
this.Index = index;
|
||||
this.Data = data;
|
||||
this.Ascii = ascii;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of this row.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int Index { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of this row in hex format.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string HexIndex => $"{this.Index:X8}h";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the bytes making up this row of data, in their hex representation.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string Data { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the bytes making up this row of data, in their Ascii representation.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string Ascii { get; }
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamVisualizer;
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows;
|
||||
using Microsoft.VisualStudio.Extensibility.UI;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel class representing the data contained by a <see cref="MemoryStream"/>.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class MemoryStreamData : NotifyPropertyChangedObject
|
||||
{
|
||||
private long length;
|
||||
private long position;
|
||||
private Visibility loadingVisibility = Visibility.Visible;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the length of the <see cref="MemoryStream"/>.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public long Length
|
||||
{
|
||||
get => this.length;
|
||||
set
|
||||
{
|
||||
if (this.SetProperty(ref this.length, value))
|
||||
{
|
||||
this.RaiseNotifyPropertyChangedEvent(nameof(this.HexLength));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the <see cref="MemoryStream"/> in hex format.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string HexLength => $"{this.length:X}h";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current position of the <see cref="MemoryStream"/>.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public long Position
|
||||
{
|
||||
get => this.position;
|
||||
set
|
||||
{
|
||||
if (this.SetProperty(ref this.position, value))
|
||||
{
|
||||
this.RaiseNotifyPropertyChangedEvent(nameof(this.HexPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current position of the <see cref="MemoryStream"/> in hex format.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string HexPosition => $"{this.position:X}h";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data currently contained in the <see cref="MemoryStream"/>.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public ObservableList<HexEditorRow> Data { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the loading bar should be visible.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Visibility LoadingVisibility
|
||||
{
|
||||
get => this.loadingVisibility;
|
||||
set => this.SetProperty(ref this.loadingVisibility, value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamVisualizer;
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MemoryStreamObjectSource;
|
||||
using Microsoft.VisualStudio.Extensibility;
|
||||
using Microsoft.VisualStudio.Extensibility.DebuggerVisualizers;
|
||||
using Microsoft.VisualStudio.RpcContracts.RemoteUI;
|
||||
|
||||
/// <summary>
|
||||
/// Debugger visualizer provider for <see cref="MemoryStream"/>.
|
||||
/// </summary>
|
||||
[VisualStudioContribution]
|
||||
internal class MemoryStreamDebuggerVisualizerProvider : DebuggerVisualizerProvider
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override DebuggerVisualizerProviderConfiguration DebuggerVisualizerProviderConfiguration => new(
|
||||
visualizerDisplayName: "%MemoryStreamVisualizer.MemoryStreamDebuggerVisualizerProvider.Name%",
|
||||
targetType: typeof(MemoryStream))
|
||||
{
|
||||
VisualizerObjectSourceType = new VisualizerObjectSourceType(typeof(MemoryStreamVisualizerObjectSource)),
|
||||
Style = VisualizerStyle.ToolWindow,
|
||||
};
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override Task<IRemoteUserControl> CreateVisualizerAsync(VisualizerTarget visualizerTarget, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult<IRemoteUserControl>(new MemoryStreamVisualizerUserControl(visualizerTarget));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
||||
<!-- The VisualStudio.Extensibility preview packages are available from the azure-public/vside/msft_consumption feed -->
|
||||
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include=".vsextension\**\string-resources.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="MemoryStreamVisualizerUserControl.xaml" />
|
||||
<EmbeddedResource Include="MemoryStreamVisualizerUserControl.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MemoryStreamObjectSource\MemoryStreamObjectSource.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\..\bin\samples\MemoryStreamObjectSource\$(Configuration)\netstandard2.0\MemoryStreamObjectSource.dll" Link="netstandard2.0\MemoryStreamObjectSource.dll" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,148 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace MemoryStreamVisualizer;
|
||||
|
||||
using MemoryStreamObjectSource;
|
||||
using Microsoft.VisualStudio.Extensibility.DebuggerVisualizers;
|
||||
using Microsoft.VisualStudio.Extensibility.UI;
|
||||
using Microsoft.VisualStudio.RpcContracts.DebuggerVisualizers;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Remote UI user control for the MemoryStreamVisualizer,
|
||||
/// </summary>
|
||||
internal class MemoryStreamVisualizerUserControl : RemoteUserControl
|
||||
{
|
||||
private readonly VisualizerTarget visualizerTarget;
|
||||
private readonly MemoryStreamData dataContext;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemoryStreamVisualizerUserControl"/> class.
|
||||
/// </summary>
|
||||
/// <param name="visualizerTarget">The visualizer target to be used to retrieve data from.</param>
|
||||
public MemoryStreamVisualizerUserControl(VisualizerTarget visualizerTarget)
|
||||
: base(new MemoryStreamData())
|
||||
{
|
||||
visualizerTarget.StateChanged += this.VisualizerTargetStateChangedAsync;
|
||||
|
||||
this.dataContext = (MemoryStreamData)this.DataContext!;
|
||||
this.visualizerTarget = visualizerTarget;
|
||||
}
|
||||
|
||||
private Task VisualizerTargetStateChangedAsync(object? sender, VisualizerTargetStateNotification args)
|
||||
{
|
||||
if (args == VisualizerTargetStateNotification.Available || args == VisualizerTargetStateNotification.ValueUpdated)
|
||||
{
|
||||
this.dataContext.Data.Clear();
|
||||
this.dataContext.Position = 0;
|
||||
this.dataContext.Length = 0;
|
||||
this.dataContext.LoadingVisibility = Visibility.Visible;
|
||||
|
||||
return this.RetrieveDataAsync();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task RetrieveDataAsync()
|
||||
{
|
||||
ReadOnlySequence<byte> data;
|
||||
do
|
||||
{
|
||||
using MemoryStream memoryStream = new(sizeof(int));
|
||||
using BinaryWriter binaryWriter = new(memoryStream);
|
||||
int index = this.dataContext.Data.Count * MemoryStreamVisualizerObjectSource.RowLength;
|
||||
if (index >= 1024 * 1024)
|
||||
{
|
||||
break; // Let's not retrieve more than 1MB of data
|
||||
}
|
||||
|
||||
binaryWriter.Write(index);
|
||||
binaryWriter.Flush();
|
||||
try
|
||||
{
|
||||
data = (await this.visualizerTarget.ObjectSource.RequestDataAsync(new ReadOnlySequence<byte>(memoryStream.ToArray()), CancellationToken.None)).Value;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// I can get an exception if the debug session is unpaused, so I need to handle it gracefully
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (data.Length > 0 && this.Read(data));
|
||||
|
||||
this.dataContext.LoadingVisibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private bool Read(ReadOnlySequence<byte> data)
|
||||
{
|
||||
int byteInRowCount = 0;
|
||||
StringBuilder binaryText = new();
|
||||
StringBuilder asciiText = new();
|
||||
|
||||
SequenceReader<byte> reader = new(data);
|
||||
if (!reader.TryReadLittleEndian(out long position) || !reader.TryReadLittleEndian(out long length))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.dataContext.Position = position;
|
||||
this.dataContext.Length = length;
|
||||
|
||||
if (reader.UnreadSpan.Length == 0)
|
||||
{
|
||||
return false; // We always receive data unless we are at the end of the MemoryStream
|
||||
}
|
||||
|
||||
List<HexEditorRow> rows = new(MemoryStreamVisualizerObjectSource.RowsCountPerRequest);
|
||||
byte[] tmp = new byte[1];
|
||||
while (reader.TryRead(out byte b))
|
||||
{
|
||||
byteInRowCount++;
|
||||
if (byteInRowCount > 1)
|
||||
{
|
||||
binaryText.Append(' ');
|
||||
}
|
||||
|
||||
binaryText.Append(b.ToString("X2", CultureInfo.InvariantCulture));
|
||||
tmp[0] = b;
|
||||
asciiText.Append(char.IsControl((char)b) || b == 0xAD ? '•' : Encoding.Latin1.GetChars(tmp)[0]);
|
||||
|
||||
if (byteInRowCount == MemoryStreamVisualizerObjectSource.RowLength)
|
||||
{
|
||||
CompleteRow();
|
||||
}
|
||||
}
|
||||
|
||||
if (byteInRowCount > 0)
|
||||
{
|
||||
CompleteRow();
|
||||
this.dataContext.Data.AddRange(rows);
|
||||
return false; // We only receive partial rows at the end of the MemoryStream
|
||||
}
|
||||
|
||||
this.dataContext.Data.AddRange(rows);
|
||||
return true;
|
||||
|
||||
void CompleteRow()
|
||||
{
|
||||
rows.Add(new HexEditorRow(
|
||||
index: (this.dataContext.Data.Count + rows.Count) * MemoryStreamVisualizerObjectSource.RowLength,
|
||||
data: binaryText.ToString(),
|
||||
ascii: asciiText.ToString()));
|
||||
|
||||
byteInRowCount = 0;
|
||||
binaryText.Clear();
|
||||
asciiText.Clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vs="http://schemas.microsoft.com/visualstudio/extensibility/2022/xaml"
|
||||
xmlns:styles="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
|
||||
xmlns:colors="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ProgressBar IsIndeterminate="True" VerticalAlignment="Top" Visibility="{Binding LoadingVisibility}" Style="{StaticResource {x:Static styles:VsResourceKeys.ProgressBarStyleKey}}" />
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<Label VerticalAlignment="Center" Style="{StaticResource {x:Static styles:VsResourceKeys.ThemedDialogLabelStyleKey}}">Position: </Label>
|
||||
<TextBox IsReadOnly="True" Width="75" VerticalAlignment="Center">
|
||||
<TextBox.Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Static styles:VsResourceKeys.TextBoxStyleKey}}">
|
||||
<Setter Property="Text" Value="{Binding Position, Mode=OneWay}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=HexCheck, FallbackValue=True}" Value="True">
|
||||
<Setter Property="Text" Value="{Binding HexPosition, Mode=OneWay}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBox.Style>
|
||||
</TextBox>
|
||||
<Label Margin="2,0,0,0" VerticalAlignment="Center" Style="{StaticResource {x:Static styles:VsResourceKeys.ThemedDialogLabelStyleKey}}">Length:</Label>
|
||||
<TextBox IsReadOnly="True" Width="100" VerticalAlignment="Center">
|
||||
<TextBox.Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Static styles:VsResourceKeys.TextBoxStyleKey}}">
|
||||
<Setter Property="Text" Value="{Binding Length, Mode=OneWay}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=HexCheck, FallbackValue=True}" Value="True">
|
||||
<Setter Property="Text" Value="{Binding HexLength, Mode=OneWay}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBox.Style>
|
||||
</TextBox>
|
||||
<CheckBox x:Name="HexCheck" Margin="5,0,0,0" VerticalAlignment="Center" Style="{StaticResource {x:Static styles:VsResourceKeys.CheckBoxStyleKey}}">Hex</CheckBox>
|
||||
</StackPanel>
|
||||
<DataGrid ItemsSource="{Binding Data}"
|
||||
EnableRowVirtualization="True"
|
||||
AutoGenerateColumns="False"
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="Cell"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
CanUserSortColumns="False"
|
||||
IsReadOnly="True"
|
||||
Grid.Row="2">
|
||||
<DataGrid.Resources>
|
||||
<Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type DataGrid}, ResourceId=DataGridSelectAllButtonStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Rectangle Fill="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingBackgroundBrushKey}}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Style>
|
||||
<Style TargetType="{x:Type DataGrid}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingBackgroundBrushKey}}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridLineBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Style>
|
||||
</DataGrid.Style>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingBackgroundBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static colors:ThemedDialogColors.WindowPanelTextBrushKey}}"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.RowHeaderStyle>
|
||||
<Style TargetType="{x:Type DataGridRowHeader}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingBackgroundBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingTextBrushKey}}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridLineBrushKey}}"/>
|
||||
<Setter Property="Content" Value="{Binding Index, Mode=OneWay}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=HexCheck, FallbackValue=True}" Value="True">
|
||||
<Setter Property="Content" Value="{Binding HexIndex, Mode=OneWay}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowHeaderStyle>
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingBackgroundBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridHeadingTextBrushKey}}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static colors:ThemedDialogColors.GridLineBrushKey}}"/>
|
||||
<Setter Property="Padding" Value="2,0,0,0"/>
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static colors:ThemedDialogColors.ActionButtonStrokeHoverBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static colors:ThemedDialogColors.ActionButtonTextActiveBrushKey}}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static colors:ThemedDialogColors.ActionButtonStrokeHoverBrushKey}}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Hex value" Binding="{Binding Data}" FontFamily="Consolas" />
|
||||
<DataGridTextColumn Header="Ascii" Binding="{Binding Ascii}" FontFamily="Consolas" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<RootNamespace>RegexMatchVisualizer</RootNamespace>
|
||||
<DefineConstants>$(DefineConstants);VISUALIZER</DefineConstants>
|
||||
|
@ -13,8 +13,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<RootNamespace>RegexMatchVisualizer.ObjectSource</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -31,7 +31,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DialogSample", "DialogSampl
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InsertGuid", "InsertGuid\InsertGuid.csproj", "{E9A9549D-5F36-4C82-86A5-824A538B8E51}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSProjectQueryAPISample", "VSProjectQueryAPISample\VSProjectQueryAPISample.csproj", "{AA2CA55C-851A-471B-96DD-660A43E1F9FB}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VSProjectQueryAPISample", "VSProjectQueryAPISample\VSProjectQueryAPISample.csproj", "{AA2CA55C-851A-471B-96DD-660A43E1F9FB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ToolWindowSample", "ToolWindowSample\ToolWindowSample.csproj", "{B44726AE-1F46-4C3A-BF1E-321E43E4BE9D}"
|
||||
EndProject
|
||||
|
@ -43,6 +43,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RegexMatchObjectSource", "R
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WordCountMarginSample", "WordCountMargin\WordCountMarginSample.csproj", "{60341B35-AE0D-43D1-B6FA-DB02309BC8D1}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MemoryStreamDebugVisualizer", "MemoryStreamDebugVisualizer", "{D235C6BF-C068-4459-A5B6-9C508B8A9FEB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryStreamObjectSource", "MemoryStreamDebugVisualizer\MemoryStreamObjectSource\MemoryStreamObjectSource.csproj", "{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryStreamVisualizer", "MemoryStreamDebugVisualizer\MemoryStreamVisualizer\MemoryStreamVisualizer.csproj", "{AA31B852-5E22-4CAC-AF38-B62FA592E747}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -107,22 +113,6 @@ Global
|
|||
{54B4B640-D71B-493D-80CF-DD37B17F1E75}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{54B4B640-D71B-493D-80CF-DD37B17F1E75}.Release|x86.ActiveCfg = Release|x86
|
||||
{54B4B640-D71B-493D-80CF-DD37B17F1E75}.Release|x86.Build.0 = Release|x86
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{24317836-E83F-4565-B7C7-F412CFF4463B}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{30A57F3B-B2DC-414D-A37B-2A4ECB819D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{30A57F3B-B2DC-414D-A37B-2A4ECB819D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{30A57F3B-B2DC-414D-A37B-2A4ECB819D4B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
@ -147,6 +137,14 @@ Global
|
|||
{E9A9549D-5F36-4C82-86A5-824A538B8E51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9A9549D-5F36-4C82-86A5-824A538B8E51}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E9A9549D-5F36-4C82-86A5-824A538B8E51}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AA2CA55C-851A-471B-96DD-660A43E1F9FB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B44726AE-1F46-4C3A-BF1E-321E43E4BE9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B44726AE-1F46-4C3A-BF1E-321E43E4BE9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B44726AE-1F46-4C3A-BF1E-321E43E4BE9D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
@ -179,6 +177,22 @@ Global
|
|||
{60341B35-AE0D-43D1-B6FA-DB02309BC8D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{60341B35-AE0D-43D1-B6FA-DB02309BC8D1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{60341B35-AE0D-43D1-B6FA-DB02309BC8D1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -188,6 +202,8 @@ Global
|
|||
{54B4B640-D71B-493D-80CF-DD37B17F1E75} = {3849D25F-DB2F-4F28-B73D-3E154CBACAC0}
|
||||
{646BC52B-12B8-4FB0-A483-119771576560} = {8554ABE3-9105-4AF7-9318-81414CC190C6}
|
||||
{176CF461-98DA-403B-9CCD-BA8695BB8586} = {8554ABE3-9105-4AF7-9318-81414CC190C6}
|
||||
{BFEE0E3B-025D-4AB6-A40B-0E05F7DBFB90} = {D235C6BF-C068-4459-A5B6-9C508B8A9FEB}
|
||||
{AA31B852-5E22-4CAC-AF38-B62FA592E747} = {D235C6BF-C068-4459-A5B6-9C508B8A9FEB}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {40A38C8A-61B7-427B-A430-DEB75BE34F22}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812;CA1303</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -55,9 +55,8 @@ internal class TextViewMarginProvider : ExtensionPart, ITextViewMarginProvider,
|
|||
/// </summary>
|
||||
public async Task<IRemoteUserControl> CreateVisualElementAsync(ITextViewSnapshot textView, CancellationToken cancellationToken)
|
||||
{
|
||||
var documentSnapshot = await textView.GetTextDocumentAsync(cancellationToken).ConfigureAwait(false);
|
||||
var dataModel = new WordCountData();
|
||||
dataModel.WordCount = CountWords(documentSnapshot);
|
||||
dataModel.WordCount = CountWords(textView.Document);
|
||||
this.dataModels[textView.Uri] = dataModel;
|
||||
return new MyMarginContent(dataModel);
|
||||
}
|
||||
|
@ -65,8 +64,7 @@ internal class TextViewMarginProvider : ExtensionPart, ITextViewMarginProvider,
|
|||
/// <inheritdoc />
|
||||
public async Task TextViewChangedAsync(TextViewChangedArgs args, CancellationToken cancellationToken)
|
||||
{
|
||||
var documentSnapshot = await args.AfterTextView.GetTextDocumentAsync(cancellationToken);
|
||||
this.dataModels[args.AfterTextView.Uri].WordCount = CountWords(documentSnapshot);
|
||||
this.dataModels[args.AfterTextView.Uri].WordCount = CountWords(args.AfterTextView.Document);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>11</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<NoWarn>$(NoWarn);CS1591;IDE0008;CA1812;CA2007</NoWarn>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.1024-preview-2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Sdk" Version="17.8.2055-preview-3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Extensibility.Build" Version="17.8.2055-preview-3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
16
README.md
16
README.md
|
@ -78,9 +78,9 @@ Read an overview of the areas of the SDK that you might need for your extension
|
|||
* To learn how to use the output window in an extension, see [Output window](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/output-window/output-window).
|
||||
* To learn how to work with tool windows, dockable windows within the Visual Studio IDE, see [Tool windows](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/tool-window/tool-window).
|
||||
* To learn how to use prompts with customizable buttons to interact with the user, see [User prompts](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/user-prompt/user-prompts).
|
||||
* To learn how to use dialogs with custom UI to interact with the user, see [Dialogs](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/dialog/dialog)
|
||||
* To learn how to create custom data visualizations when debugging, see [Debugger Visualizers](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/debugger-visualizer/debugger-visualizers)
|
||||
* To learn how to query or modify information about project sand solutions, see [Project Query](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/project/project)
|
||||
* To learn how to use dialogs with custom UI to interact with the user, see [Dialogs](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/dialog/dialog).
|
||||
* To learn how to create custom data visualizations when debugging, see [Debugger Visualizers](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/debugger-visualizer/debugger-visualizers).
|
||||
* To learn how to query or modify information about project sand solutions, see [Project Query](https://learn.microsoft.com/visualstudio/extensibility/visualstudio.extensibility/project/project).
|
||||
|
||||
## Samples and tutorials
|
||||
|
||||
|
@ -88,12 +88,12 @@ A Visual Studio solution containing all samples can be found at [Samples.sln](Ne
|
|||
|
||||
| Sample | Description|
|
||||
|-|-|
|
||||
| [Simple command handler](New_Extensibility_Model/Samples/SimpleRemoteCommandSample) | Demonstrates the basics of working with commands. See also the [Create your first extension](docs/new-extensibility-model/getting-started/create-your-first-extension.md) tutorial.|
|
||||
| [Insert guid extension](New_Extensibility_Model/Samples/InsertGuid) | Shows how to insert text or code in the code editor. See also the [tutorial](docs/new-extensibility-model/getting-started/tutorial-create-simple-extension.md). |
|
||||
| [Simple command handler](New_Extensibility_Model/Samples/SimpleRemoteCommandSample) | Demonstrates the basics of working with commands. See also the [Create your first extension](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/get-started/create-your-first-extension) tutorial.|
|
||||
| [Insert guid extension](New_Extensibility_Model/Samples/InsertGuid) | Shows how to insert text or code in the code editor. See also the [tutorial](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/get-started/tutorial-create-simple-extension). |
|
||||
| [Command configuration](New_Extensibility_Model/Samples/CommandRegistrationsSample) | Shows how to configure a command with specific activation conditions. This command also uses a resource file for localization. |
|
||||
| [Command parenting](New_Extensibility_Model/Samples/CommandParentingSample) | Shows how to author a command that can be parented to different aspects of the IDE. |
|
||||
| [Document selector](New_Extensibility_Model/Samples/DocumentSelectorSample) | Shows how to create an editor extension that is only applicable to files matching a file path pattern. |
|
||||
| [Output window](New_Extensibility_Model/Samples/OutputWindowSample) | Shows the most basic use of the [Output Window API](./new-extensibility-model/extension-guides/outputWindow/outputWindow.md)|
|
||||
| [Output window](New_Extensibility_Model/Samples/OutputWindowSample) | Shows the most basic use of the [Output Window API](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/output-window/output-window).|
|
||||
| [Tool window](New_Extensibility_Model/Samples/ToolWindowSample) | Shows how to create a tool window and populate it with content. |
|
||||
| [User prompt](New_Extensibility_Model/Samples/UserPromptSample) | Shows how to display a prompt to the user. |
|
||||
| [Dialog](New_Extensibility_Model/Samples/DialogSample) | Shows how to display a dialog with custom UI to the user. |
|
||||
|
@ -111,9 +111,7 @@ A Visual Studio solution containing all samples can be found at [Samples.sln](Ne
|
|||
|
||||
## API Docs
|
||||
|
||||
* [Microsoft.VisualStudio.Extensibility](docs/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.md)
|
||||
* [Microsoft.VisualStudio.Extensibility.Editor](docs/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.Editor.md)
|
||||
* [Microsoft.VisualStudio.ProjectSystem.Query](docs/new-extensibility-model/api/Microsoft.VisualStudio.ProjectSystem.Query.md)
|
||||
* API Docs are available on [learn.microsoft.com](https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.extensibility).
|
||||
|
||||
## Send feedback
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
I"‡{"source"=>"C:/Users/lerich/OneDrive - Microsoft/VSExtensibility/docs", "destination"=>"C:/Users/lerich/OneDrive - Microsoft/VSExtensibility/docs/_site", "collections_dir"=>"", "cache_dir"=>".jekyll-cache", "plugins_dir"=>"_plugins", "layouts_dir"=>"_layouts", "data_dir"=>"_data", "includes_dir"=>"_includes", "collections"=>{"posts"=>{"output"=>true, "permalink"=>"/:categories/:year/:month/:day/:title:output_ext"}}, "safe"=>false, "include"=>[".htaccess"], "exclude"=>[".sass-cache", ".jekyll-cache", "gemfiles", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"], "keep_files"=>[".git", ".svn"], "encoding"=>"utf-8", "markdown_ext"=>"markdown,mkdown,mkdn,mkd,md", "strict_front_matter"=>false, "show_drafts"=>nil, "limit_posts"=>0, "future"=>false, "unpublished"=>false, "whitelist"=>[], "plugins"=>[], "markdown"=>"kramdown", "highlighter"=>"rouge", "lsi"=>false, "excerpt_separator"=>"\n\n", "incremental"=>false, "detach"=>false, "port"=>"4000", "host"=>"127.0.0.1", "baseurl"=>nil, "show_dir_listing"=>false, "permalink"=>"date", "paginate_path"=>"/page:num", "timezone"=>nil, "quiet"=>false, "verbose"=>false, "defaults"=>[{"scope"=>{"path"=>""}, "values"=>{"layout"=>"default"}}], "liquid"=>{"error_mode"=>"warn", "strict_filters"=>false, "strict_variables"=>false}, "kramdown"=>{"auto_ids"=>true, "toc_levels"=>[1, 2, 3, 4, 5, 6], "entity_output"=>"as_char", "smart_quotes"=>"lsquo,rsquo,ldquo,rdquo", "input"=>"GFM", "hard_wrap"=>false, "guess_lang"=>true, "footnote_nr"=>1, "show_warnings"=>false, "syntax_highlighter"=>"rouge", "syntax_highlighter_opts"=>{:default_lang=>"plaintext", :guess_lang=>true}, "coderay"=>{}}, "title"=>"Visual Studio Extensibility", "description"=>"Visual Studio Extensibility", "layout"=>"default", "css"=>{"syntax"=>true}, "sass"=>{"style"=>:compressed}, "livereload_port"=>35729, "serving"=>true, "watch"=>true, "url"=>nil}:ET
|
|
@ -1,18 +0,0 @@
|
|||
I"Ç<h1 id="visual-studio-extensibility-nuget-packages">Visual Studio Extensibility Nuget Packages</h1>
|
||||
<p>The new extensibilty model for Visual Studio depends on a set of new nuget packages to provide APIs, build tooling, code generation and analyzers.</p>
|
||||
|
||||
<h2 id="microsoftvisualstudioextensibility">Microsoft.VisualStudio.Extensibility</h2>
|
||||
<p>Link: <TBD></TBD></p>
|
||||
|
||||
<p>This package contains the SDK APIs and utility libraries to help develop extensions using the out-of-process extensibility model. Every extension should include a reference to this package as a starting point.</p>
|
||||
|
||||
<h2 id="microsoftvisualstudioextensibilitybuild">Microsoft.VisualStudio.Extensibility.Build</h2>
|
||||
<p>Link: <TBD></TBD></p>
|
||||
|
||||
<p>This package contains the build tooling, code generators that is necessary for extension metadata to be generated during build. Without this package, a compiled extension may not work correctly as it will not contain the necessary metadata files.</p>
|
||||
|
||||
<h2 id="microsoftvisualstudioextensibilityeditor">Microsoft.VisualStudio.Extensibility.Editor</h2>
|
||||
<p>This package contains the editor related SDK APIs and utilities and is included as a dependency from <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility</code>.</p>
|
||||
|
||||
<p>In future previews, we may have similar nuget packages that are not included as a required dependency but can be added as needed to provide APIs for certain feature areas such as debugger, source control.</p>
|
||||
:ET
|
|
@ -1,171 +0,0 @@
|
|||
I"á<h1 id="rule-based-activation-constraints">Rule based activation constraints</h1>
|
||||
|
||||
<p>One of the common concepts in Visual Studio Extensibility SDK is use of context based activation rules in code attributes. An example of these would <code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute declaring when a command is made visible.</p>
|
||||
|
||||
<p>Our goal is to provide a common way to create such contexts, the current method is based on existing <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions">Rule-based UI contexts</a> with a different set of context terms.</p>
|
||||
|
||||
<h2 id="constraint-attribute-arguments">Constraint attribute arguments</h2>
|
||||
|
||||
<p>Each constraint attribute will contain at least 3 required arguments that defines the expression:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Expression string: A boolean expression using <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations and term names that are defined in later arguments. Each term must be a single word (without spaces) and expression can utilize parantheses for grouping and <code class="language-plaintext highlighter-rouge">&</code>, <code class="language-plaintext highlighter-rouge">|</code>, <code class="language-plaintext highlighter-rouge">!</code> operators for <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term names: An array that contains the name of the terms used in the expression above.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term definitions: An array that defines the each term in the order terms are defined in the names array above.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="example-definition">Example definition</h2>
|
||||
|
||||
<p>In the example below, the code attributes defines when a command is in enabled state.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The expression indicates that command is enabled when both <code class="language-plaintext highlighter-rouge">SolutionLoaded</code> and <code class="language-plaintext highlighter-rouge">IsValidFile</code> terms are true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">SolutionLoaded</code> term is defined as <code class="language-plaintext highlighter-rouge">SolutionState:Exists</code> which indicates, the term evaluates to <code class="language-plaintext highlighter-rouge">true</code> when a solution exists in the IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">IsValidFile</code> term is true when selected file in Solution Explorer is a jpeg or text file as defined by the file extension.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionLoaded"</span><span class="p">,</span>
|
||||
<span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionState:Exists"</span><span class="p">,</span>
|
||||
<span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="available-terms">Available terms</h2>
|
||||
|
||||
<p>Following is the list of terms currently supported by expression engine.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Term</th>
|
||||
<th>Description</th>
|
||||
<th>Â </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SolutionHasProjectBuildProperty:<property>=<regex></td>
|
||||
<td>The term is true when solution has a loaded project with the specified build property and property value matches to regex filter provided.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectCapability:<expression></td>
|
||||
<td>True whenever solution has a project with capabilities matching the provided subexpression. An expression can be something like VB</td>
|
||||
<td>CSharp.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectFlavor:<guid></td>
|
||||
<td>True whenever a solution has project that is flavored (aggregated) and has a flavor matching the given project type GUID.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionState:<state></td>
|
||||
<td>True when solution state matches to provided value, see <a href="#solution-states">solution states</a> for list of values.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectAddedItem:<pattern></td>
|
||||
<td>The term is true when a file matching the “patternâ€<C3A2> is added to a project in the soluion that is opened.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext:<key>=<pattern></td>
|
||||
<td>True when the provided client context key matches to regular expression. See <a href="#client-contexts">client contexts</a> for more details.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="solution-states">Solution states</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NoSolution</td>
|
||||
<td>No solution loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exists</td>
|
||||
<td>A solution is opened but may be in loaded or loading state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FullyLoaded</td>
|
||||
<td>A solution is opened and fully loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empty</td>
|
||||
<td>Solution contains no projects but may contain solution items.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SingleProject</td>
|
||||
<td>Solution contains a single project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MultipleProject</td>
|
||||
<td>Solution contains multiple projects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building</td>
|
||||
<td>Solution is building.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="client-contexts">Client contexts</h2>
|
||||
<p>Activation rules can also utilize the <a href="ExtensionAnatomy.md#client-context">client context</a> contents as parts of its expression.</p>
|
||||
|
||||
<p>Currently, the client context is limited to a small set of values in IDE state:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Context key</th>
|
||||
<th>Definition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionUri</td>
|
||||
<td>Full URI for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionPath</td>
|
||||
<td>Full path for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionFileName</td>
|
||||
<td>File name of the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorContentType</td>
|
||||
<td>Content type of the active editor view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorFileName</td>
|
||||
<td>File name for the document that belongs to active editor view.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
:ET
|
|
@ -1,173 +0,0 @@
|
|||
I"á<h1 id="rule-based-activation-constraints">Rule based activation constraints</h1>
|
||||
|
||||
<p>One of the common concepts in Visual Studio Extensibility SDK is use of context based activation rules in code attributes. An example of these would <code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute declaring when a command is made visible.</p>
|
||||
|
||||
<p>Our goal is to provide a common way to create such contexts, the current method is based on existing <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions">Rule-based UI contexts</a> with a different set of context terms.</p>
|
||||
|
||||
<h2 id="constraint-attribute-arguments">Constraint attribute arguments</h2>
|
||||
|
||||
<p>Each constraint attribute will contain at least 3 required arguments that defines the expression:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Expression string: A boolean expression using <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations and term names that are defined in later arguments. Each term must be a single word (without spaces) and expression can utilize parantheses for grouping and <code class="language-plaintext highlighter-rouge">&</code>, <code class="language-plaintext highlighter-rouge">|</code>, <code class="language-plaintext highlighter-rouge">!</code> operators for <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term names: An array that contains the name of the terms used in the expression above.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term definitions: An array that defines the each term in the order terms are defined in the names array above.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="example-definition">Example definition</h2>
|
||||
|
||||
<p>In the example below, the code attributes defines when a command is in enabled state.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The expression indicates that command is enabled when both <code class="language-plaintext highlighter-rouge">SolutionLoaded</code> and <code class="language-plaintext highlighter-rouge">IsValidFile</code> terms are true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">SolutionLoaded</code> term is defined as <code class="language-plaintext highlighter-rouge">SolutionState:Exists</code> which indicates, the term evaluates to <code class="language-plaintext highlighter-rouge">true</code> when a solution exists in the IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">IsValidFile</code> term is true when selected file in Solution Explorer is a jpeg or text file as defined by the file extension.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionLoaded"</span><span class="p">,</span>
|
||||
<span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionState:Exists"</span><span class="p">,</span>
|
||||
<span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="available-terms">Available terms</h2>
|
||||
|
||||
<p>Following is the list of terms currently supported by expression engine.</p>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Term</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SolutionHasProjectBuildProperty:<property>=<regex></td>
|
||||
<td>The term is true when solution has a loaded project with the specified build property and property value matches to regex filter provided.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectCapability:<expression></td>
|
||||
<td>True whenever solution has a project with capabilities matching the provided subexpression. An expression can be something like VB</td>
|
||||
<td>CSharp.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectFlavor:<guid></td>
|
||||
<td>True whenever a solution has project that is flavored (aggregated) and has a flavor matching the given project type GUID.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionState:<state></td>
|
||||
<td>True when solution state matches to provided value, see <a href="#solution-states">solution states</a> for list of values.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectAddedItem:<pattern></td>
|
||||
<td>The term is true when a file matching the “patternâ€<C3A2> is added to a project in the soluion that is opened.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext:<key>=<pattern></td>
|
||||
<td>True when the provided client context key matches to regular expression. See <a href="#client-contexts">client contexts</a> for more details.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="solution-states">Solution states</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NoSolution</td>
|
||||
<td>No solution loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exists</td>
|
||||
<td>A solution is opened but may be in loaded or loading state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FullyLoaded</td>
|
||||
<td>A solution is opened and fully loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empty</td>
|
||||
<td>Solution contains no projects but may contain solution items.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SingleProject</td>
|
||||
<td>Solution contains a single project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MultipleProject</td>
|
||||
<td>Solution contains multiple projects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building</td>
|
||||
<td>Solution is building.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="client-contexts">Client contexts</h2>
|
||||
<p>Activation rules can also utilize the <a href="ExtensionAnatomy.md#client-context">client context</a> contents as parts of its expression.</p>
|
||||
|
||||
<p>Currently, the client context is limited to a small set of values in IDE state:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Context key</th>
|
||||
<th>Definition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionUri</td>
|
||||
<td>Full URI for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionPath</td>
|
||||
<td>Full path for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionFileName</td>
|
||||
<td>File name of the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorContentType</td>
|
||||
<td>Content type of the active editor view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorFileName</td>
|
||||
<td>File name for the document that belongs to active editor view.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
:ET
|
|
@ -1,8 +0,0 @@
|
|||
I"á<h1 id="announcements">Announcements</h1>
|
||||
<p>Use this page to stay up-to-date on all upcoming extensibility announcements and critical SDK/API updates.</p>
|
||||
|
||||
<h2 id="august-16-2021">August 16, 2021</h2>
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
:ET
|
|
@ -1,80 +0,0 @@
|
|||
I"»!<h1 id="anatomy-of-a-new-visual-studio-extension">Anatomy of a new Visual Studio Extension</h1>
|
||||
<p>An extension utilizing the new extensibility SDK will have several components that interact together and also with Visual Studio.</p>
|
||||
|
||||
<h2 id="extension-instance">Extension instance</h2>
|
||||
<p>The starting point for each extension is an instance of <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Extension</code>. This instance contains the necessary methods for Visual Studio to query services provided by the extension and also provides virtual methods for extension to provide localized resourcs and extension owned local services to be shared between the components of the extension.</p>
|
||||
|
||||
<p>For simple extensions that don’t require such services, a default implementation will be created by code generators at build time. See <code class="language-plaintext highlighter-rouge">SimpleRemoteCommandSample</code> extension for such an example.</p>
|
||||
|
||||
<p>In other cases, such as <code class="language-plaintext highlighter-rouge">MarkdownLinter</code> extension project will have its own class that derives from <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Extension</code> to customize certain aspects of the extension.</p>
|
||||
|
||||
<p>For extension developers that are familiar with the existing VS SDK APIs, this class is very similar to <code class="language-plaintext highlighter-rouge">AsyncPackage</code> class that is used in the in-process extensibility model.</p>
|
||||
|
||||
<h2 id="visualstudioextensibility-object">VisualStudioExtensibility object</h2>
|
||||
<p>The object <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility</code> acts as the entry point for extensibility features exposed by Visual Studio. This class will have various extension methods, properties to quickly enumerate through available features in extensibility SDK. Please see the (TBD:link) API documentation for available methods.</p>
|
||||
|
||||
<h2 id="extension-parts">Extension parts</h2>
|
||||
<p>For features where an extension contributes components to Visual Studio such as commands, editor listeners, extensions will utilize attributed classes. Build process will generate the correct metadata to ensure these components can be discovered by Visual Studio.</p>
|
||||
|
||||
<p>Currently the SDK supports a limited set of components to be exported:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="TBD">Command handlers</a></li>
|
||||
<li><a href="TBD">Text view lifetime listeners</a> for tracking text view created, closed events.</li>
|
||||
<li><a href="TBD">Text view change listeners</a> for tracking changes to an open text view.</li>
|
||||
</ul>
|
||||
|
||||
<p>Instances for these classes will be created as part of the extensibility framework provided by the SDK using dependency injection library and constructors can be used to retrieve instances of services provided by either the SDK or by the extension itself to share state across components.</p>
|
||||
|
||||
<h3 id="lifetime-of-extension-parts">Lifetime of extension parts</h3>
|
||||
<p>Lifetime of each part is managed by the respective commponent that loads those parts inside Visual Studio IDE process.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Command handlers will be initialized when the corresponding command set is activated which can be during the first execution of the command. Once activated, command handlers should only be disposed when IDE is shutdown.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Similarly text view event listeners will be initialized when the first text view matching the content type specified is loaded in the IDE. Currently, such listeners will be active until IDE is shutdown but this behavior may change in future.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>In general, for complex extensions we recommend extension to provide local services that parts can import in their constructor and using those services to share state across parts and across instances of the same part. This will ensure that extension state is not affected by lifetime changes of extension parts.</p>
|
||||
|
||||
<h3 id="services-provided-by-sdk-for-injection">Services provided by SDK for injection</h3>
|
||||
<p>The following services are provided by the SDK that can be used in constructor for any extension part:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code>: Every extension part can inject an instance of <code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code> to interact with Visual Studio IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">Extension</code>: Parts can inject <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Extension</code> type or the extensions own type inheriting from it to extension parts.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">TraceSource</code>: A trace source instance is created on demand for each extension that can be used to record diagnostic information. These instances are registered with Visual Studio diagnostics provider which can be used to merge logs from multiple services and utilize future tooling to access real time logging. See <a href="Logging.md">Logging</a> section for more information.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Local services: Any local services provided by the extension itself will also be available for dependency injection.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="local-extension-services">Local extension services</h2>
|
||||
<p>In certain scenarios an extension may want to share state between different components such as a command handler and a text view change listener, as it can be seen in <code class="language-plaintext highlighter-rouge">MarkdownLinter</code> example. These services can be added to in-process service collection via overriding <code class="language-plaintext highlighter-rouge">Extension.InitializeServices</code> method and as instances of extension parts are created, the services will be injected based on the constructor arguments.</p>
|
||||
|
||||
<p>There are 3 options that a service can be added:</p>
|
||||
|
||||
<ul>
|
||||
<li><code class="language-plaintext highlighter-rouge">AddTransient</code>: A new instance of the service is created for each part that ingests it.</li>
|
||||
<li><code class="language-plaintext highlighter-rouge">AddScoped</code>: A new instance of the service is created within a certain scope. In context of Visual Studio extensibility, scope refers to a single extension part.</li>
|
||||
<li><code class="language-plaintext highlighter-rouge">AddSingleton</code>: There is a single shared instance of service that is created on first ingestion.</li>
|
||||
</ul>
|
||||
|
||||
<p>Due to lifetime of <code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code> object being bound to the scope of a single extension part, any local service that ingests it has to be a scoped or transient service. Trying to create a singleton service that injects <code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code> will result in failure.</p>
|
||||
|
||||
<p>For an example of how local services are used please see <a href="../Extension_Guides/MarkdownLinterSample.md">MarkdownLinte extension guide</a>.</p>
|
||||
|
||||
<h2 id="client-context">Client context</h2>
|
||||
<p>As all extensions in the new SDK runs out of process, we introduce the concept of client context for various extension parts to represent the state of the IDE as when the event or method is invoked. This context is represented by <code class="language-plaintext highlighter-rouge">IClientContext</code> instance in the SDK and is passed in to various operations such as command execution handlers. The SDK provides extension methods on <code class="language-plaintext highlighter-rouge">IClientContext</code> that can be utilized to retrieve objects from the context. For example extensions can get the active text view or the URI for the selected items at the time of command execution utilizing <code class="language-plaintext highlighter-rouge">IClientContext</code> instance.</p>
|
||||
|
||||
<p>Some components such as commands, will also have allow extension developers to declare which contexts they are interested. This is done to optimize the amount of data transferred in each remote execution since client context can get large in the future. In the initial preview, there are only two available contexts <code class="language-plaintext highlighter-rouge">Shell</code> and <code class="language-plaintext highlighter-rouge">Editor</code> and both are included by default when declaring a command using <code class="language-plaintext highlighter-rouge">CommandAttribute</code>.</p>
|
||||
:ET
|
|
@ -1,5 +0,0 @@
|
|||
I"<01><h2 id="ooops">Ooops</h2>
|
||||
<p>The page you are looking for could not be found. It might have been renamed or moved.</p>
|
||||
|
||||
<p>Try finding it from the menu.</p>
|
||||
:ET
|
|
@ -1,11 +0,0 @@
|
|||
I"´<p>There are several sets of API reference documentation that you might find relevant to check out.</p>
|
||||
|
||||
<h2 id="the-community-visual-studio-toolkit">The Community Visual Studio Toolkit</h2>
|
||||
|
||||
<p>When using the Community Visual Studio Toolkit, make sure to check out its <a href="https://vsixcommunity.github.io/Community.VisualStudio.Toolkit/v1/api/">API reference</a>.</p>
|
||||
|
||||
<h2 id="the-official-sdk-reference">The official SDK reference</h2>
|
||||
|
||||
<p>The official API reference contain basic information about all the types found in the entire public SDK. Find it at
|
||||
<a href="https://docs.microsoft.com/visualstudio/extensibility/visual-studio-sdk-reference">Visual Studio SDK reference</a></p>
|
||||
:ET
|
|
@ -1,375 +0,0 @@
|
|||
I"Vk<h1 id="visual-studio-extensions-to-the-language-server-protocol">Visual Studio extensions to the Language Server Protocol</h1>
|
||||
|
||||
<p>This document describes the Visual Studio specific extensions to the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/">Language Server Protocol</a>. These extensions can be used by servers to provide additional functionalities when communicating with a Visual Studio instance.</p>
|
||||
|
||||
<p>These extensions are composed of:</p>
|
||||
<ol>
|
||||
<li>Classes which extend base classes from the LSP specification allowing to provide additional information to Visual Studio. For example <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> adding support for tooltips, sorting, etc.</li>
|
||||
<li>Additional methods like <a href="#getprojectcontexts">GetProjectContexts</a>. These are listed in <a href="#vsmethods"><code class="language-plaintext highlighter-rouge">VSMethods</code></a>.</li>
|
||||
<li>Additional capabilities that a language server can provide to the Visual Studio client. These are defined in <a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">VSServerCapabilities</code></a> and can be communicated to the client in the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#initializeResult"><code class="language-plaintext highlighter-rouge">InitializeResult.capabilities</code></a> field of the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#initialize"><code class="language-plaintext highlighter-rouge">initialize</code></a> request.</li>
|
||||
<li>Additional values for enumerations described in the LSP protocol. For example <a href="#vsdiagnostictags"><code class="language-plaintext highlighter-rouge">VSDiagnosticTags</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnosticTag"><code class="language-plaintext highlighter-rouge">DiagnosticTag</code></a>.</li>
|
||||
</ol>
|
||||
|
||||
<p>A .NET implementation of these extensions can be found on <a href="https://www.nuget.org/packages/Microsoft.VisualStudio.LanguageServer.Protocol.Extensions">NuGet</a>.</p>
|
||||
|
||||
<p>When using this package in a language server, configure the <code class="language-plaintext highlighter-rouge">JsonSerializer</code> using <code class="language-plaintext highlighter-rouge">VSExtensionUtilities.AddVSExtensionConverters</code> in order to allow extensions classes to be correctly deserialized. For example, this allows the <code class="language-plaintext highlighter-rouge">JsonSerializer</code> to correctly deserialize the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction"><code class="language-plaintext highlighter-rouge">CodeAction.Diagnostics</code></a> entries of a <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction_resolve"><code class="language-plaintext highlighter-rouge">codeAction/resolve</code></a> request into <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> objects even if <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction"><code class="language-plaintext highlighter-rouge">CodeAction.Diagnostics</code></a> is defined as an array of <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> objects.</p>
|
||||
|
||||
<h1 id="new-methods">New methods</h1>
|
||||
|
||||
<h2 id="getprojectcontexts">GetProjectContexts</h2>
|
||||
|
||||
<p><em>GetProjectContexts</em> requests are sent from the client to the server to retrieve a list of the project contexts associated with a text document. An example of project contexts are <a href="https://docs.microsoft.com/en-us/dotnet/standard/frameworks#how-to-specify-a-target-framework">multiple target frameworks</a> in SDK style .NET projects.</p>
|
||||
|
||||
<p>The labels of all project contexts are presented to the user in the navigation bar at the top of the document. When the user changes the project context in the navigation bar, the active project context is changed.</p>
|
||||
|
||||
<p>The client includes the active project context in requests to the server by filling in the <a href="#vstextdocumentidentifier"><code class="language-plaintext highlighter-rouge">VSTextDocumentIdentifier._vs_projectContext</code></a> property.</p>
|
||||
|
||||
<p><em>Server Capability</em></p>
|
||||
|
||||
<ul>
|
||||
<li>property path (optional): <a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">_vs_projectContextProvider</code></a></li>
|
||||
<li>property type: <code class="language-plaintext highlighter-rouge">boolean</code></li>
|
||||
</ul>
|
||||
|
||||
<p><em>Request</em></p>
|
||||
|
||||
<ul>
|
||||
<li>method: <code class="language-plaintext highlighter-rouge">textDocument/_vs_getProjectContexts</code></li>
|
||||
<li>params: <a href="#vsgetprojectcontextsparams"><code class="language-plaintext highlighter-rouge">VSGetProjectContextsParams</code></a></li>
|
||||
</ul>
|
||||
|
||||
<p><em>Response</em></p>
|
||||
|
||||
<ul>
|
||||
<li>result: <a href="#vsprojectcontextlist"><code class="language-plaintext highlighter-rouge">VSProjectContextList</code></a></li>
|
||||
</ul>
|
||||
|
||||
<h1 id="extensions-specification">Extensions specification</h1>
|
||||
|
||||
<h2 id="vsdiagnostic">VSDiagnostic</h2>
|
||||
|
||||
<p><a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSDiagnostic</span> <span class="kd">extends</span> <span class="nx">Diagnostic</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project and context (e.g. Win32, MacOS, etc.) in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projects</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSDiagnosticProjectInformation</span><span class="p">[],</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets an expanded description of the diagnostic.
|
||||
**/</span>
|
||||
<span class="nx">_vs_expandedMessage</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a message shown when the user hovers over an error. If null, then Diagnostic.message
|
||||
* is used (use VSDiagnosticTags.SuppressEditorToolTip to prevent a tool tip from being shown).
|
||||
**/</span>
|
||||
<span class="nx">_vs_toolTip</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a non-human-readable identier allowing consolidation of multiple equivalent diagnostics
|
||||
* (e.g. the same syntax error from builds targeting different platforms).
|
||||
**/</span>
|
||||
<span class="nx">_vs_identifier</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a string describing the diagnostic types (e.g. Security, Performance, Style, etc.).
|
||||
**/</span>
|
||||
<span class="nx">_vs_diagnosticType</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a rank associated with this diagnostic, used for the default sort.
|
||||
* VSDiagnosticRank.Default will be used if no rank is specified.
|
||||
**/</span>
|
||||
<span class="nx">_vs_diagnosticRank</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSDiagnosticRank</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets an ID used to associate this diagnostic with a corresponding line in the output window.
|
||||
**/</span>
|
||||
<span class="nx">_vs_outputId</span><span class="p">?</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnosticprojectinformation">VSDiagnosticProjectInformation</h2>
|
||||
|
||||
<p><a href="#vsdiagnosticprojectinformation"><code class="language-plaintext highlighter-rouge">VSDiagnosticProjectInformation</code></a> represents the project and context in which the <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> is generated.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSDiagnosticProjectInformation</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a human-readable identifier for the project in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectName</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a human-readable identifier for the build context (e.g. Win32 or MacOS)
|
||||
* in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nx">_vs_context</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the unique identifier for the project in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nx">_vs_projectIdentifier</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnosticrank">VSDiagnosticRank</h2>
|
||||
|
||||
<p><a href="#vsdiagnosticrank"><code class="language-plaintext highlighter-rouge">VSDiagnosticRank</code></a> represents the rank of a <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> object.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">enum</span> <span class="nx">VSDiagnosticRank</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Highest priority.
|
||||
**/</span>
|
||||
<span class="nx">Highest</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* High priority.
|
||||
**/</span>
|
||||
<span class="nx">High</span> <span class="o">=</span> <span class="mi">200</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Default priority.
|
||||
**/</span>
|
||||
<span class="nx">Default</span> <span class="o">=</span> <span class="mi">300</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Low priority.
|
||||
**/</span>
|
||||
<span class="nx">Low</span> <span class="o">=</span> <span class="mi">400</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Lowest priority.
|
||||
**/</span>
|
||||
<span class="nx">Lowest</span> <span class="o">=</span> <span class="mi">500</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnostictags">VSDiagnosticTags</h2>
|
||||
|
||||
<p>Additional <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">DiagnosticTag</code></a> values that are specific to Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="k">namespace</span> <span class="nx">VSDiagnosticTags</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry generated by the build.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">BuildError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry generated by Intellisense.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">IntellisenseError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">2</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry that could be generated from both builds
|
||||
* and Intellisense.
|
||||
*
|
||||
* Diagnostic entries tagged with VSDiagnosticTags.PotentialDuplicate will be hidden
|
||||
* in the error list if the error list is displaying build and intellisense
|
||||
* errors.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">PotentialDuplicate</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">3</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry is never displayed in the error list.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">HiddenInErrorList</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">4</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is always displayed in the error list.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">VisibleInErrorList</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">5</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is never displayed in the editor.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">HiddenInEditor</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">6</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* No tooltip is shown for the Diagnostic entry in the editor.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">SuppressEditorToolTip</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">7</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is represented in the Editor as an Edit
|
||||
* and Continue error.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">EditAndContinueError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">8</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsgetprojectcontextsparams">VSGetProjectContextsParams</h2>
|
||||
|
||||
<p><a href="#vsgetprojectcontextsparams"><code class="language-plaintext highlighter-rouge">VSGetProjectContextsParams</code></a> represents the parameter that is sent with the ‘textDocument/_vs_getProjectContexts’ request.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSGetProjectContextsParams</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the document for which project contexts are queried.
|
||||
**/</span>
|
||||
<span class="nl">_vs_textDocument</span> <span class="p">:</span> <span class="nx">TextDocumentItem</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsimageid">VSImageId</h2>
|
||||
|
||||
<p><a href="#vsimageid"><code class="language-plaintext highlighter-rouge">VSImageId</code></a> represents the unique identifier for a Visual Studio image asset. The identified is composed by a <a href="#vsimageid"><code class="language-plaintext highlighter-rouge">VSImageId._vs_guid</code></a> and an integer. A list of valid image ids can be retrieved from the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.imaging.knownmonikers">KnownMonikers class</a> from the Visual Studio SDK.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSImageId</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the VSImageId._vs_guid component of the unique identifier.
|
||||
**/</span>
|
||||
<span class="nl">_vs_guid</span> <span class="p">:</span> <span class="nx">Guid</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the integer component of the unique identifier.
|
||||
**/</span>
|
||||
<span class="nx">_vs_id</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vslocation">VSLocation</h2>
|
||||
|
||||
<p><a href="#vslocation"><code class="language-plaintext highlighter-rouge">VSLocation</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">Location</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSLocation</span> <span class="kd">extends</span> <span class="nx">Location</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project name to be displayed to user.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectName</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the text value for the display path.
|
||||
* In case the actual path on disk would be confusing for users, this should be a friendly display name.
|
||||
* This doesn't have to correspond to a real file path, but must be parsable by the System.IO.Path.GetFileName(System.String) method.
|
||||
**/</span>
|
||||
<span class="nx">_vs_displayPath</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsmethods">VSMethods</h2>
|
||||
|
||||
<p><a href="#vsmethods"><code class="language-plaintext highlighter-rouge">VSMethods</code></a> contains the string values for all Language Server Protocol Visual Studio specific methods.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="k">namespace</span> <span class="nx">VSMethods</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Method name for 'textDocument/_vs_getProjectContexts'.
|
||||
* The 'textDocument/_vs_getProjectContexts' request is sent from the client to the server to query
|
||||
* the list of project context associated with a document.
|
||||
* This method has a parameter of type VSGetProjectContextsParams and a return value of type
|
||||
* VSProjectContextList.
|
||||
* In order to enable the client to send the 'textDocument/_vs_getProjectContexts' requests, the server must
|
||||
* set the VSServerCapabilities._vs_projectContextProvider property.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">GetProjectContextsName</span> <span class="p">:</span> <span class="kr">string</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">textDocument/_vs_getProjectContexts</span><span class="dl">'</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectcontext">VSProjectContext</h2>
|
||||
|
||||
<p><a href="#vsprojectcontext"><code class="language-plaintext highlighter-rouge">VSProjectContext</code></a> represents a project context.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSProjectContext</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the label for the project context.
|
||||
**/</span>
|
||||
<span class="nl">_vs_label</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the unique identifier of the project context.
|
||||
**/</span>
|
||||
<span class="nx">_vs_id</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the context kind of the project context which is used to determine its associated icon.
|
||||
**/</span>
|
||||
<span class="nx">_vs_kind</span> <span class="p">:</span> <span class="nx">VSProjectKind</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectcontextlist">VSProjectContextList</h2>
|
||||
|
||||
<p><a href="#vsprojectcontextlist"><code class="language-plaintext highlighter-rouge">VSProjectContextList</code></a> represents the response to the ‘textDocument/_vs_getProjectContexts’ request.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSProjectContextList</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the document contexts associated with a text document.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContexts</span> <span class="p">:</span> <span class="nx">VSProjectContext</span><span class="p">[],</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the index of the default entry of the VSProjectContext array.
|
||||
**/</span>
|
||||
<span class="nx">_vs_defaultIndex</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectkind">VSProjectKind</h2>
|
||||
|
||||
<p><a href="#vsprojectkind"><code class="language-plaintext highlighter-rouge">VSProjectKind</code></a> represents the various kinds of contexts.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">enum</span> <span class="nx">VSProjectKind</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* C++ project.
|
||||
**/</span>
|
||||
<span class="nx">CPlusPlus</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* C# project.
|
||||
**/</span>
|
||||
<span class="nx">CSharp</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Visual Basic project.
|
||||
**/</span>
|
||||
<span class="nx">VisualBasic</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsservercapabilities">VSServerCapabilities</h2>
|
||||
|
||||
<p><a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">VSServerCapabilities</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">ServerCapabilities</code></a> allowing to provide additional capabilities supported by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSServerCapabilities</span> <span class="kd">extends</span> <span class="nx">ServerCapabilities</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a value indicating whether the server supports the
|
||||
* 'textDocument/_vs_getProjectContexts' request.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContextProvider</span><span class="p">?</span> <span class="p">:</span> <span class="nx">boolean</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vssymbolinformation">VSSymbolInformation</h2>
|
||||
|
||||
<p><a href="#vssymbolinformation"><code class="language-plaintext highlighter-rouge">VSSymbolInformation</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">SymbolInformation</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSSymbolInformation</span> <span class="kd">extends</span> <span class="nx">SymbolInformation</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the icon associated with the symbol. If specified, this icon is used instead of SymbolKind.
|
||||
**/</span>
|
||||
<span class="nl">_vs_icon</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSImageId</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the description of the symbol.
|
||||
**/</span>
|
||||
<span class="nx">_vs_description</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the hint text for the symbol.
|
||||
**/</span>
|
||||
<span class="nx">_vs_hintText</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vstextdocumentidentifier">VSTextDocumentIdentifier</h2>
|
||||
|
||||
<p><a href="#vstextdocumentidentifier"><code class="language-plaintext highlighter-rouge">VSTextDocumentIdentifier</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">TextDocumentIdentifier</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSTextDocumentIdentifier</span> <span class="kd">extends</span> <span class="nx">TextDocumentIdentifier</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project context of the text document.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContext</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSProjectContext</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
:ET
|
|
@ -1,164 +0,0 @@
|
|||
I"g<h1 id="rule-based-activation-constraints">Rule based activation constraints</h1>
|
||||
|
||||
<p>One of the common concepts in Visual Studio Extensibility SDK is use of context based activation rules in code attributes. An example of these would <code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute declaring when a command is made visible.</p>
|
||||
|
||||
<p>Our goal is to provide a common way to create such contexts, the current method is based on existing <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions">Rule-based UI contexts</a> with a different set of context terms.</p>
|
||||
|
||||
<h2 id="constraint-attribute-arguments">Constraint attribute arguments</h2>
|
||||
|
||||
<p>Each constraint attribute will contain at least 3 required arguments that defines the expression:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Expression string: A boolean expression using <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations and term names that are defined in later arguments. Each term must be a single word (without spaces) and expression can utilize parantheses for grouping and <code class="language-plaintext highlighter-rouge">&</code>, <code class="language-plaintext highlighter-rouge">|</code>, <code class="language-plaintext highlighter-rouge">!</code> operators for <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term names: An array that contains the name of the terms used in the expression above.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term definitions: An array that defines the each term in the order terms are defined in the names array above.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="example-definition">Example definition</h2>
|
||||
|
||||
<p>In the example below, the code attributes defines when a command is in enabled state.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The expression indicates that command is enabled when both <code class="language-plaintext highlighter-rouge">SolutionLoaded</code> and <code class="language-plaintext highlighter-rouge">IsValidFile</code> terms are true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">SolutionLoaded</code> term is defined as <code class="language-plaintext highlighter-rouge">SolutionState:Exists</code> which indicates, the term evaluates to <code class="language-plaintext highlighter-rouge">true</code> when a solution exists in the IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">IsValidFile</code> term is true when selected file in Solution Explorer is a jpeg or text file as defined by the file extension.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionLoaded"</span><span class="p">,</span>
|
||||
<span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionState:Exists"</span><span class="p">,</span>
|
||||
<span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="available-terms">Available terms</h2>
|
||||
|
||||
<p>Following is the list of terms currently supported by expression engine.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Term</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SolutionHasProjectBuildProperty:<property>=<regex></td>
|
||||
<td>The term is true when solution has a loaded project with the specified build property and property value matches to regex filter provided.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectCapability:<expression></td>
|
||||
<td>True whenever solution has a project with capabilities matching the provided sub-expression. An expression can be something like VB or C#.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectFlavor:<guid></td>
|
||||
<td>True whenever a solution has project that is flavored (aggregated) and has a flavor matching the given project type GUID.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionState:<state></td>
|
||||
<td>True when solution state matches to provided value, see <a href="#solution-states">solution states</a> for list of values.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectAddedItem:<pattern></td>
|
||||
<td>The term is true when a file matching the “pattern” is added to a project in the solution that is opened.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext:<key>=<pattern></td>
|
||||
<td>True when the provided client context key matches to regular expression. See <a href="#client-contexts">client contexts</a> for more details.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="solution-states">Solution states</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NoSolution</td>
|
||||
<td>No solution loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exists</td>
|
||||
<td>A solution is opened but may be in loaded or loading state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FullyLoaded</td>
|
||||
<td>A solution is opened and fully loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empty</td>
|
||||
<td>Solution contains no projects but may contain solution items.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SingleProject</td>
|
||||
<td>Solution contains a single project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MultipleProject</td>
|
||||
<td>Solution contains multiple projects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building</td>
|
||||
<td>Solution is building.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="client-contexts">Client contexts</h2>
|
||||
<p>Activation rules can also utilize the <a href="ExtensionAnatomy.md#client-context">client context</a> contents as parts of its expression.</p>
|
||||
|
||||
<p>Currently, the client context is limited to a small set of values in IDE state:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Context key</th>
|
||||
<th>Definition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionUri</td>
|
||||
<td>Full URI for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionPath</td>
|
||||
<td>Full path for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionFileName</td>
|
||||
<td>File name of the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorContentType</td>
|
||||
<td>Content type of the active editor view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorFileName</td>
|
||||
<td>File name for the document that belongs to active editor view.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
:ET
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,68 +0,0 @@
|
|||
I"ô<h1 id="walkthrough-markdown-linter-extension">Walkthrough: Markdown Linter Extension</h1>
|
||||
|
||||
<p>This extension shows how multiple components can interact together inside an extension and how different areas of Visual Studio can be extended.</p>
|
||||
|
||||
<h2 id="summary">Summary</h2>
|
||||
<p>Markdown Linter extension showcases samples of:</p>
|
||||
|
||||
<ul>
|
||||
<li>Creating a command handler</li>
|
||||
<li>Creating text view change and creation listeners</li>
|
||||
<li>Introducing local services that are shared across extension parts</li>
|
||||
<li>Interacting with output window and Error List.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<p>This extension assumes <code class="language-plaintext highlighter-rouge">markdownlint-cli</code> npm package is installed globally in order to successfully run linter on markdown files.</p>
|
||||
|
||||
<p>You can run <code class="language-plaintext highlighter-rouge">npm install -g markdownlint-cli</code> to install the package before running the sample.</p>
|
||||
|
||||
<h2 id="markdownlinterextension-instance">MarkdownLinterExtension instance</h2>
|
||||
<p>Different to previous samples, this extension implements its own class that inherits from <code class="language-plaintext highlighter-rouge">ExtensionWithCommand</code> as our extension contains commands and also want to introduce local services.</p>
|
||||
|
||||
<p>There are 2 interesting points in the implementation of <code class="language-plaintext highlighter-rouge">MarkdownLinterExtension</code>:</p>
|
||||
|
||||
<ul>
|
||||
<li><code class="language-plaintext highlighter-rouge">ResourceManager</code> property points to the resource dictionary that contains localized entries that would be used for creating an output window pane.</li>
|
||||
<li><code class="language-plaintext highlighter-rouge">InitializeServices</code> method is used to add local services to the dependency injection graph. As noted in <a href="../Inside_the_SDK/ExtensionAnatomy.md#local-extension-services">local services section</a>, the extension utilizes a scoped <code class="language-plaintext highlighter-rouge">MarkdownDiagnosticsService</code> as the service instance injects <code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code> object.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="markdowndiagnosticsservice-local-service">MarkdownDiagnosticsService local service</h2>
|
||||
<p>In this example, this local service acts as the central for managing markdown file diagnostics. It is responsible for running markdown linter on the files requested and forward errors to diagnostic service.</p>
|
||||
|
||||
<p>For more information on individual APIs used please refer to:</p>
|
||||
|
||||
<ul>
|
||||
<li>Views API for output window</li>
|
||||
<li>Languages API for diagnostics</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="runlinteroncurrentfilecommand">RunLinterOnCurrentFileCommand</h2>
|
||||
<p>One part of the extension is a command that can run markdown linter on the current selected file in Solution Explorer.</p>
|
||||
|
||||
<p>The command retrieves the selection from <code class="language-plaintext highlighter-rouge">IClientContext</code> instance and forwards the request to local <code class="language-plaintext highlighter-rouge">MarkdownDiagnosticsService</code> service instance.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Get the selected item URIs from IDE context that reprents the state when command was executed.</span>
|
||||
<span class="kt">var</span> <span class="n">selectedItemPaths</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Uri</span><span class="p">[]</span> <span class="p">{</span> <span class="k">await</span> <span class="n">context</span><span class="p">.</span><span class="nf">GetSelectedPathAsync</span><span class="p">(</span><span class="n">cancellationToken</span><span class="p">)</span> <span class="p">};</span>
|
||||
|
||||
<span class="c1">// Enumerate through each selection and run linter on each selected item.</span>
|
||||
<span class="k">foreach</span> <span class="p">(</span><span class="kt">var</span> <span class="n">selectedItem</span> <span class="k">in</span> <span class="n">selectedItemPaths</span><span class="p">.</span><span class="nf">Where</span><span class="p">(</span><span class="n">p</span> <span class="p">=></span> <span class="n">p</span><span class="p">.</span><span class="n">IsFile</span><span class="p">))</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">await</span> <span class="k">this</span><span class="p">.</span><span class="n">diagnosticsProvider</span><span class="p">.</span><span class="nf">ProcessFileAsync</span><span class="p">(</span><span class="n">selectedItem</span><span class="p">,</span> <span class="n">cancellationToken</span><span class="p">);</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="textvieweventlistener">TextViewEventListener</h2>
|
||||
<p>Another part of the extension is an editor component that listens for new editor view creation and changes to open views. This component monitors for events on <code class="language-plaintext highlighter-rouge">.md</code> files and routes the request to <code class="language-plaintext highlighter-rouge">MarkdownDiagnosticsService</code> as contents change.</p>
|
||||
|
||||
<p>Note that because this extension part implements two contract interfaces, it must ensure that both contracts are specified as an extension part:</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">ExtensionPart</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">ITextViewLifetimeListener</span><span class="p">))]</span>
|
||||
<span class="p">[</span><span class="nf">ExtensionPart</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">ITextViewChangedListener</span><span class="p">))]</span>
|
||||
<span class="p">[</span><span class="nf">AppliesTo</span><span class="p">(</span><span class="n">ContentType</span> <span class="p">=</span> <span class="s">"text"</span><span class="p">)]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The extension part also utilizes <code class="language-plaintext highlighter-rouge">AppliesTo</code> attribute to indicate that it is interested in events from views with <code class="language-plaintext highlighter-rouge">text</code> content type. (Note, this is required as there is no <code class="language-plaintext highlighter-rouge">markdown</code> content type in Visual Studio)</p>
|
||||
|
||||
<p>Even though this class implements 2 different contracts, a single instance of it will be created so that state can be shared between different editor components that interact together.</p>
|
||||
:ET
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,239 +0,0 @@
|
|||
I"8H<h1 id="editor-extensions">Editor Extensions</h1>
|
||||
|
||||
<p>The Visual Studio editor supports extensions that add to its capabilities. For the initial release of the new
|
||||
Visual Studio extensibility model, only the following capabilities are supported:</p>
|
||||
|
||||
<ul>
|
||||
<li>Listening for text views being opened and closed.</li>
|
||||
<li>Listening for text view (editor) state changes.</li>
|
||||
<li>Reading the text of the document and the caret locations.</li>
|
||||
<li>Performing text edits.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="editor-extensibility-entrypoints">Editor Extensibility Entrypoints</h2>
|
||||
|
||||
<p>Editor extensibility currently supports 3 entry points: listeners, the EditorExtensibility service object, and
|
||||
commands.</p>
|
||||
|
||||
<h3 id="adding-a-listener">Adding a Listener</h3>
|
||||
|
||||
<p>There are two types of listeners, ITextViewChangedListener, and ITextViewLifetimeListener.
|
||||
Together, these listeners can be used to observe the open, close, and modification of text editors.</p>
|
||||
|
||||
<p>To get started:</p>
|
||||
|
||||
<ul>
|
||||
<li>Add a reference to the <a href="https://www.nuget.org/TODO-add-real-link">Microsoft.VisualStudio.Extensibility.Editor</a>
|
||||
and <a href="https://www.nuget.org/TODO-add-real-link">Microsoft.VisualStudio.Extensibility.Build</a> NuGet packages to your
|
||||
project.</li>
|
||||
<li>Change your project’s <code class="language-plaintext highlighter-rouge">TargetFramework</code> from <code class="language-plaintext highlighter-rouge">net6.0</code> to <code class="language-plaintext highlighter-rouge">net6.0-windows</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p>Then, create a new class, implementing <code class="language-plaintext highlighter-rouge">ExtensionPart</code> base class and <code class="language-plaintext highlighter-rouge">ITextViewChangedListener</code>,
|
||||
<code class="language-plaintext highlighter-rouge">ITextViewLifetimeListener</code>, or both. Then, add an <code class="language-plaintext highlighter-rouge">[ExtensionPart(typeof(ITextViewChangedListener))]</code> attribute for
|
||||
each listener interface you implemented and an <code class="language-plaintext highlighter-rouge">[AppliesTo(ContentType = "CSharp")]</code> attribute to your class.
|
||||
ExtensionPart indicates to Visual Studio that this class can be instantiated by interested IDE services, and triggers
|
||||
registration of the part in your extension’s manifest.</p>
|
||||
|
||||
<p>Assuming you decide to implement both listeners, the finished class declaration should look like the following:</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">[</span><span class="nf">ExtensionPart</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">ITextViewLifetimeListener</span><span class="p">))]</span>
|
||||
<span class="p">[</span><span class="nf">ExtensionPart</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">ITextViewChangedListener</span><span class="p">))]</span>
|
||||
<span class="p">[</span><span class="nf">AppliesTo</span><span class="p">(</span><span class="n">ContentType</span> <span class="p">=</span> <span class="s">"CSharp"</span><span class="p">)]</span>
|
||||
<span class="k">public</span> <span class="k">sealed</span> <span class="k">class</span> <span class="nc">TextViewOperationListener</span> <span class="p">:</span> <span class="n">ExtensionPart</span><span class="p">,</span> <span class="n">ITextViewLifetimeListener</span><span class="p">,</span> <span class="n">ITextViewChangedListener</span>
|
||||
<span class="p">{</span>
|
||||
<span class="p">...</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>When you run your extension, you should see:</p>
|
||||
|
||||
<ul>
|
||||
<li>ITextViewLifetimeListener.TextViewCreatedAsync() called anytime an editor is opened by the user.</li>
|
||||
<li>ITextViewLifetimeListener.TextViewClosedAsync() called anytime an editor is closed by the user.</li>
|
||||
<li>ITextViewChangedListener.TextViewChangedAsync() called anytime a user makes a text change in the editor.</li>
|
||||
</ul>
|
||||
|
||||
<p>Each of these methods are passed an ITextView containing the state of the text editor at the time the
|
||||
user invoked the action and a CancellationToken that will have <code class="language-plaintext highlighter-rouge">IsCancellationRequested == true</code> when
|
||||
the IDE wishes to cancel a pending action.</p>
|
||||
|
||||
<h4 id="appliesto-attribute">AppliesTo Attribute</h4>
|
||||
|
||||
<p>AppliesTo attribute indicates the programming language scenarios in which the extension should activate. It is written as
|
||||
<code class="language-plaintext highlighter-rouge">[AppliesTo(ContentType = "CSharp")]</code>, where ContentType is a well known name of a language built into Visual Studio,
|
||||
or custom defined in a Visual Studio extension.</p>
|
||||
|
||||
<p>Note that registering custom content types is not yet supported in the
|
||||
new extensibility model.</p>
|
||||
|
||||
<p><strong>Some Well Known Content Types</strong>:</p>
|
||||
<ul>
|
||||
<li>“CSharp” - C#</li>
|
||||
<li>“C/C++” - C, C++, headers, and IDL</li>
|
||||
<li>“TypeScript” - TypeScript and JavaScript type languages.</li>
|
||||
<li>“HTML” - HTML</li>
|
||||
<li>“JSON” - JSON</li>
|
||||
<li>“text” - text files, including hierarchical descendents of “code”, which descends from “text”.</li>
|
||||
<li>“code” - C, C++, C#, etc.</li>
|
||||
</ul>
|
||||
|
||||
<p>ContentTypes are hierarchical. e.g.: C# and C++ both descend from “code”, so declaring “code” will cause your extension
|
||||
to activate for C#, C, C++, etc.</p>
|
||||
|
||||
<h3 id="editorextensibility">EditorExtensibility</h3>
|
||||
|
||||
<p>Visual Studio ExtensionParts all expose a <code class="language-plaintext highlighter-rouge">this.Extensibility</code> property. Using this property, you can
|
||||
request an instance of the EditorExtensibility object, which exposes on demand editor functionality, such as
|
||||
performing text edits.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">EditorExtensibility</span> <span class="n">editorService</span> <span class="p">=</span> <span class="k">this</span><span class="p">.</span><span class="n">Extensibility</span><span class="p">.</span><span class="nf">Editor</span><span class="p">();</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="getting-an-itextview-within-a-command">Getting an ITextView within a Command</h3>
|
||||
|
||||
<p><code class="language-plaintext highlighter-rouge">ExecuteCommandAsync()</code> in each Command is passed an IClientContext that contains a snapshot of the state of the IDE
|
||||
at the time the command was invoked. You can access the active ITextView from this using EditorExtensibility.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">using</span> <span class="nn">ITextView</span> <span class="n">textView</span> <span class="p">=</span> <span class="k">await</span> <span class="k">this</span><span class="p">.</span><span class="n">Extensibility</span><span class="p">.</span><span class="nf">Editor</span><span class="p">().</span><span class="nf">GetActiveTextViewAsync</span><span class="p">(</span><span class="n">clientContext</span><span class="p">,</span> <span class="n">cancellationToken</span><span class="p">);</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="object-model">Object Model</h2>
|
||||
|
||||
<p>The Visual Studio Editor extensibility object model is composed of a few integral parts.</p>
|
||||
|
||||
<h3 id="itextview">ITextView</h3>
|
||||
<p>ITextView contains the URI and version information necessary to acquire an ITextDocument as well
|
||||
as some properties of the text view, such as selections.</p>
|
||||
|
||||
<ul>
|
||||
<li>This object is immutable and will never change after it is created.</li>
|
||||
<li>You can use <code class="language-plaintext highlighter-rouge">ITextView.GetTextDocumentAsync()</code> to get the content from the document. Note that calling this method is
|
||||
expensive and only should be done if you need the document content.</li>
|
||||
<li>ITextView cannot be changed directly. All changes are requested via Mutation. See Mutation Section below.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="itextdocument">ITextDocument</h3>
|
||||
<p>ITextDocument contains the content of the text document from a point in time or version.</p>
|
||||
|
||||
<ul>
|
||||
<li>This object is immutable and will never change after it is created.</li>
|
||||
<li>ITextDocument cannot be changed directly. All changes are requested via Mutation. See Mutation Section below.</li>
|
||||
</ul>
|
||||
|
||||
<p>If you are familiar with legacy Visual Studio extensions, ITextDocument is almost 1:1 with
|
||||
<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.itextsnapshot?view=visualstudiosdk-2019">ITextSnapshot</a>
|
||||
and supports most of the same methods for accessing the text.</p>
|
||||
|
||||
<p>Best Practices:</p>
|
||||
<ul>
|
||||
<li>Avoid calling <code class="language-plaintext highlighter-rouge">.GetText()</code>.
|
||||
<ul>
|
||||
<li>You can use Position and Span to represent substrings in the document without expending resources copying or allocating strings. Most APIs will operate in terms of these primitives.</li>
|
||||
<li>You can use the indexer syntax, <code class="language-plaintext highlighter-rouge">textDocument[0]</code>, to read character by character in the document without copying it to a string.</li>
|
||||
<li>If you must create a string such as for use as a dictionary key, use the overload that takes a Span, to avoid creating a large throwaway string from the entire line or document.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Avoid assuming lines or documents will be short. Many languages minify into huge lines or consume very large files.</li>
|
||||
<li>ITextDocument references large data structures that may consume memory if an old enough version is stored. Best practice is to periodically update Positions and Spans that you are storing long term to the latest document version via their <code class="language-plaintext highlighter-rouge">TranslateTo()</code> method so the old ITextDocument version can be garbage collected.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="position">Position</h3>
|
||||
<p>Represents a position within the text document. As opposed to <code class="language-plaintext highlighter-rouge">int</code> positions, the Position type
|
||||
is aware of the ITextDocument it came from and supports <code class="language-plaintext highlighter-rouge">GetChar()</code> to directly get the character at that point.</p>
|
||||
|
||||
<p>If you are familiar with legacy Visual Studio extensions, Position is almost 1:1 with
|
||||
<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.snapshotpoint?view=visualstudiosdk-2019">SnapshotPoint</a>
|
||||
and supports most of the same methods.</p>
|
||||
|
||||
<h3 id="span">Span</h3>
|
||||
<p>Represents a contiguous substring of characters within an ITextDocument. As opposed to a string created with
|
||||
<code class="language-plaintext highlighter-rouge">string.Substring()</code> or <code class="language-plaintext highlighter-rouge">ITextDocument.GetText()</code>, creating a span doesn’t require any allocations or additional
|
||||
memory. You can later call <code class="language-plaintext highlighter-rouge">Span.GetText()</code> to realize it into a string in a deferred fashion.</p>
|
||||
|
||||
<p>If you are familiar with legacy Visual Studio extensions, Position is almost 1:1 with
|
||||
<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.snapshotSpan?view=visualstudiosdk-2019">SnapshotSpan</a>
|
||||
and supports most of the same methods.</p>
|
||||
|
||||
<h2 id="mutation-and-asynchronicity">Mutation and Asynchronicity</h2>
|
||||
|
||||
<h3 id="mutation">Mutation</h3>
|
||||
|
||||
<p>In the new Visual Studio extensibility model, the extension is second class relative to the user: it cannot directly
|
||||
modify the editor or the text document. All state changes are asynchronous and cooperative, with Visual Studio IDE performing
|
||||
the requested change on the extension’s behalf. The extension can request one or more changes on on a specific version of
|
||||
the document or text view.</p>
|
||||
|
||||
<p>Mutations are requested using the <code class="language-plaintext highlighter-rouge">MutateAsync()</code> method on <code class="language-plaintext highlighter-rouge">EditorExtensibility</code>.</p>
|
||||
|
||||
<p>If you are familiar with legacy Visual Studio extensions, ITextDocumentMutator is almost 1:1 with the state changing
|
||||
methods from
|
||||
<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.itextbuffer?view=visualstudiosdk-2019">ITextBuffer</a>
|
||||
and <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.itextdocument?view=visualstudiosdk-2019">ITextDocument</a>
|
||||
and supports most of the same capabilities.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">MutationResult</span> <span class="n">result</span> <span class="p">=</span> <span class="k">await</span> <span class="k">this</span><span class="p">.</span><span class="n">Extensibility</span><span class="p">.</span><span class="nf">Editor</span><span class="p">().</span><span class="nf">MutateAsync</span><span class="p">(</span>
|
||||
<span class="n">m</span> <span class="p">=></span>
|
||||
<span class="p">{</span>
|
||||
<span class="kt">var</span> <span class="n">mutator</span> <span class="p">=</span> <span class="n">m</span><span class="p">.</span><span class="nf">GetMutator</span><span class="p">(</span><span class="n">document</span><span class="p">);</span>
|
||||
<span class="n">mutator</span><span class="p">.</span><span class="nf">Replace</span><span class="p">(</span><span class="n">textView</span><span class="p">.</span><span class="n">Selection</span><span class="p">.</span><span class="n">Extent</span><span class="p">,</span> <span class="n">newGuidString</span><span class="p">);</span>
|
||||
<span class="p">},</span>
|
||||
<span class="n">cancellationToken</span><span class="p">);</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>To avoid misplaced edits, editor extension edits are applied like so:</p>
|
||||
|
||||
<ul>
|
||||
<li>Extension requests an edit be made, based on its most recent version of the document.</li>
|
||||
<li>That request may contain one or more text edits, caret position changes, etc. Any type implementing <code class="language-plaintext highlighter-rouge">IMutatable</code>
|
||||
can be changed in a single <code class="language-plaintext highlighter-rouge">MutateAsync()</code> request, including ITextView and ITextDocument. Mutations
|
||||
are done by mutators, which can be requested on a specific class via <code class="language-plaintext highlighter-rouge">m.GetMutator()</code>.</li>
|
||||
<li>Mutation request is sent to Visual Studio IDE, where it succeeds only if the object being mutated hasn’t changed
|
||||
since the version the request was made one. If the document has changed, the change may be rejected, requiring
|
||||
the extension to retry on newer version. Outcome of mutation operation is stored in <code class="language-plaintext highlighter-rouge">result</code>.</li>
|
||||
<li>Mutations are applied atomically. The best practice is to do all changes that should occur within a narrow time
|
||||
frame into a single MutateAsync() call, to reduce the likelihood of unexpected behavior arising from user edits,
|
||||
or language service actions that occur between mutations (e.g.: extension edits getting interleaved with Roslyn C#
|
||||
moving the caret).</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="asynchronicity">Asynchronicity</h3>
|
||||
|
||||
<p>GetTextDocumentAsync() opens a copy of the text document in the Visual Studio extension. Since extensions run in a
|
||||
separate process, all extension interactions are asynchronous, cooperative, and have some caveats:</p>
|
||||
|
||||
<ul>
|
||||
<li>GetTextDocumentAsync() may fail if called on a really old ITextDocument because it may no longer be cached by the
|
||||
Visual Studio client, if the user has made many changes since it was created. For
|
||||
this reason, if you plan to store an ITextView to access its document later, and cannot tolerate failure, it may
|
||||
be a good idea to call GetTextDocumentAsync() immediately. Doing so fetches the text content for that version of
|
||||
the document into your extension, ensuring that a copy of that version is sent to your extension before it expires.</li>
|
||||
<li>GetTextDocumentAsync() or MutateAsync() may fail if the user closes the document.</li>
|
||||
</ul>
|
||||
|
||||
<p><img src="DocumentOpenFlow.PNG" alt="Document Open Diagram" /></p>
|
||||
|
||||
<h3 id="rpc-support">RPC Support</h3>
|
||||
|
||||
<p>Since the new Visual Studio extensibility model is entirely in a separate process, all APIs have to at some
|
||||
level operate with serializable data types. Typically, extensions can ignore these implementation details,
|
||||
however, in some scenarios, an extension may need to interface directly with RPC services acquired from
|
||||
<code class="language-plaintext highlighter-rouge">this.Extensibility.ServiceBroker</code>. To facilitate interactions with RPC services, the object model exposes
|
||||
<code class="language-plaintext highlighter-rouge">RpcContract</code> properties on most core types, and the following serializable RPC types.</p>
|
||||
|
||||
<ul>
|
||||
<li>VersionedTextDocumentRange - 1:1 serializable version of Span, accessible via <code class="language-plaintext highlighter-rouge">.RpcContract</code>. This type should be used in most RPC contracts between processes.</li>
|
||||
<li>VersionedTextDocumentPosition - 1:1 serializable version of Position, accessible via <code class="language-plaintext highlighter-rouge">.RpcContract</code>. This type should be used in most RPC contracts between processes.</li>
|
||||
<li>Range - Serializable version of Span, omitting the Uri and version number.</li>
|
||||
<li>Microsoft.VisualStudio.RpcContracts.Utilities.Position - Serializable version of Position, omitting the Uri and version number.</li>
|
||||
<li>TextView - 1:1 serialized form of ITextView, accessible via <code class="language-plaintext highlighter-rouge">.RpcContract</code>.</li>
|
||||
<li>TextDocument - 1:1 serialized form of ITextDocument via <code class="language-plaintext highlighter-rouge">.RpcContract</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p>As opposed to VersionedTextDocumentRange and VersionedTextDocumentPosition, Range and Microsoft.VisualStudio.RpcContracts.Utilities.Position
|
||||
omit the Uri and document version, making for a smaller serializable representation. This type should be used in RPC contracts that contain
|
||||
lots of span/range equivalents that need to reduce their payload size for performance. These RPC contracts will need to pass the document
|
||||
Uri and version for the spans/range to be rehydrated into Spans and Positions by the IEditorHostService.
|
||||
IEditorHostService interfaces with extension-local copies of the text buffer, and manages opening and closing of
|
||||
documents described by the RPC types.</p>
|
||||
:ET
|
|
@ -1,167 +0,0 @@
|
|||
I"£<h1 id="rule-based-activation-constraints">Rule based activation constraints</h1>
|
||||
|
||||
<p>One of the common concepts in Visual Studio Extensibility SDK is use of context based activation rules in code attributes. An example of these would <code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute declaring when a command is made visible.</p>
|
||||
|
||||
<p>Our goal is to provide a common way to create such contexts, the current method is based on existing <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions">Rule-based UI contexts</a> with a different set of context terms.</p>
|
||||
|
||||
<h2 id="constraint-attribute-arguments">Constraint attribute arguments</h2>
|
||||
|
||||
<p>Each constraint attribute will contain at least 3 required arguments that defines the expression:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Expression string: A boolean expression using <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations and term names that are defined in later arguments. Each term must be a single word (without spaces) and expression can utilize parantheses for grouping and <code class="language-plaintext highlighter-rouge">&</code>, <code class="language-plaintext highlighter-rouge">|</code>, <code class="language-plaintext highlighter-rouge">!</code> operators for <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term names: An array that contains the name of the terms used in the expression above.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term definitions: An array that defines the each term in the order terms are defined in the names array above.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="example-definition">Example definition</h2>
|
||||
|
||||
<p>In the example below, the code attributes defines when a command is in enabled state.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The expression indicates that command is enabled when both <code class="language-plaintext highlighter-rouge">SolutionLoaded</code> and <code class="language-plaintext highlighter-rouge">IsValidFile</code> terms are true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">SolutionLoaded</code> term is defined as <code class="language-plaintext highlighter-rouge">SolutionState:Exists</code> which indicates, the term evaluates to <code class="language-plaintext highlighter-rouge">true</code> when a solution exists in the IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">IsValidFile</code> term is true when selected file in Solution Explorer is a jpeg or text file as defined by the file extension.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionLoaded"</span><span class="p">,</span>
|
||||
<span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionState:Exists"</span><span class="p">,</span>
|
||||
<span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="available-terms">Available terms</h2>
|
||||
|
||||
<p>Following is the list of terms currently supported by expression engine.</p>
|
||||
|
||||
<p>| Term | Description
|
||||
| – | – |</p>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SolutionHasProjectBuildProperty:<property>=<regex></td>
|
||||
<td>The term is true when solution has a loaded project with the specified build property and property value matches to regex filter provided.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectCapability:<expression></td>
|
||||
<td>True whenever solution has a project with capabilities matching the provided subexpression. An expression can be something like VB</td>
|
||||
<td>CSharp.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectFlavor:<guid></td>
|
||||
<td>True whenever a solution has project that is flavored (aggregated) and has a flavor matching the given project type GUID.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionState:<state></td>
|
||||
<td>True when solution state matches to provided value, see <a href="#solution-states">solution states</a> for list of values.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectAddedItem:<pattern></td>
|
||||
<td>The term is true when a file matching the “patternâ€<C3A2> is added to a project in the soluion that is opened.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext:<key>=<pattern></td>
|
||||
<td>True when the provided client context key matches to regular expression. See <a href="#client-contexts">client contexts</a> for more details.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="solution-states">Solution states</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NoSolution</td>
|
||||
<td>No solution loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exists</td>
|
||||
<td>A solution is opened but may be in loaded or loading state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FullyLoaded</td>
|
||||
<td>A solution is opened and fully loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empty</td>
|
||||
<td>Solution contains no projects but may contain solution items.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SingleProject</td>
|
||||
<td>Solution contains a single project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MultipleProject</td>
|
||||
<td>Solution contains multiple projects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building</td>
|
||||
<td>Solution is building.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="client-contexts">Client contexts</h2>
|
||||
<p>Activation rules can also utilize the <a href="ExtensionAnatomy.md#client-context">client context</a> contents as parts of its expression.</p>
|
||||
|
||||
<p>Currently, the client context is limited to a small set of values in IDE state:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Context key</th>
|
||||
<th>Definition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionUri</td>
|
||||
<td>Full URI for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionPath</td>
|
||||
<td>Full path for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionFileName</td>
|
||||
<td>File name of the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorContentType</td>
|
||||
<td>Content type of the active editor view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorFileName</td>
|
||||
<td>File name for the document that belongs to active editor view.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
:ET
|
|
@ -1,2 +0,0 @@
|
|||
I"/<h1 id="announcements">Announcements</h1>
|
||||
:ET
|
|
@ -1,179 +0,0 @@
|
|||
I"Â><h1 id="commands">Commands</h1>
|
||||
|
||||
<p>Commands trigger actions in Visual Studio. They manifest as buttons parented to menus and/or toolbars in the IDE with their execution tied to user interaction. Commands in the new Extensibility Model run asynchronously and so the user can continue to interact with IDE while commands are executing.</p>
|
||||
|
||||
<h2 id="creating-new-commands">Creating new commands</h2>
|
||||
|
||||
<p>To get started:</p>
|
||||
|
||||
<ul>
|
||||
<li>Add a reference to the <a href="https://www.nuget.org/TODO-add-real-link">Microsoft.VisualStudio.Extensibility</a> and <a href="https://www.nuget.org/TODO-add-real-link">Microsoft.VisualStudio.Extensibility.Build</a> NuGet packages to your project.</li>
|
||||
<li>Change your project’s <code class="language-plaintext highlighter-rouge">TargetFramework</code> from <code class="language-plaintext highlighter-rouge">net6.0</code> to <code class="language-plaintext highlighter-rouge">net6.0-windows</code>.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="registering-a-command">Registering a command</h3>
|
||||
|
||||
<p>Creating a command with the new Extensibility Model is as simple as extending the base class <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.Command</code> and adorning your class with the attribute <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandAttribute</code>.</p>
|
||||
|
||||
<p>The attribute <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandAttribute</code> has a few parameters that you should become familiar with:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Type</th>
|
||||
<th>Required</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>String</td>
|
||||
<td>Yes</td>
|
||||
<td>A globally unique identifier for the command. It is recommended to use the full class name of your command here.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Id</td>
|
||||
<td>ushort</td>
|
||||
<td>Yes</td>
|
||||
<td>A locally unique identifier for your command within your extension. Each command within your extension should use a different value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DisplayName</td>
|
||||
<td>String</td>
|
||||
<td>Yes</td>
|
||||
<td>The default display name of your command. Surround this string with the ‘%’ character to enable localizing this string. See more on this at <a href="#localizing-a-command">Localizing a command</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ContainerType</td>
|
||||
<td>Type?</td>
|
||||
<td>No</td>
|
||||
<td>The type that is to act as the CommandSet for this command. Setting this parameter to null automatically generates a default CommandSet for your command.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Placement</td>
|
||||
<td>KnownCommandPlacement</td>
|
||||
<td>No</td>
|
||||
<td>Indicates where within Visual Studio your command should be parented. If no placement is provided the command defaults to being parented to the Standard toolbar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext</td>
|
||||
<td>String</td>
|
||||
<td>No</td>
|
||||
<td>Client contexts requested by the command, separated by ‘,’. By default the Shell and Editor contexts are returned. A client context is a snapshot of specific IDE states at the time a command was originally executed. Since these commands are executed asynchronously this state could change between the time the user executed the command and the command handler running. See more on this at <a href="./../../Inside_the_SDK/Activation_Constraints.md/#client-contexts">Client contexts</a>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">[</span><span class="nf">Command</span><span class="p">(</span><span class="n">CommandName</span><span class="p">,</span> <span class="n">CommandId</span><span class="p">,</span> <span class="s">"Sample Remote Command"</span><span class="p">,</span> <span class="n">placement</span><span class="p">:</span> <span class="n">KnownCommandPlacement</span><span class="p">.</span><span class="n">ToolsMenu</span><span class="p">)]</span>
|
||||
<span class="k">public</span> <span class="k">class</span> <span class="nc">CommandHandler</span> <span class="p">:</span> <span class="n">Command</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">private</span> <span class="k">const</span> <span class="kt">ushort</span> <span class="n">CommandId</span> <span class="p">=</span> <span class="m">1</span><span class="p">;</span>
|
||||
<span class="k">private</span> <span class="k">const</span> <span class="kt">string</span> <span class="n">CommandName</span> <span class="p">=</span> <span class="s">"SimpleRemoteCommandSample.Command"</span><span class="p">;</span>
|
||||
|
||||
<span class="k">public</span> <span class="nf">CommandHandler</span><span class="p">(</span><span class="n">VisualStudioExtensibility</span> <span class="n">extensibility</span><span class="p">,</span> <span class="n">TraceSource</span> <span class="n">traceSource</span><span class="p">,</span> <span class="kt">ushort</span> <span class="n">id</span><span class="p">)</span>
|
||||
<span class="p">:</span> <span class="k">base</span><span class="p">(</span><span class="n">extensibility</span><span class="p">,</span> <span class="n">id</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="k">public</span> <span class="k">override</span> <span class="n">Task</span> <span class="nf">ExecuteCommandAsync</span><span class="p">(</span><span class="n">IClientContext</span> <span class="n">context</span><span class="p">,</span> <span class="n">CancellationToken</span> <span class="n">cancellationToken</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">return</span> <span class="n">Task</span><span class="p">.</span><span class="n">CompletedTask</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>See the <a href="./../InsertGuidSample.md">InsertGuidSample</a> sample to get started with creating an extension with a command.</p>
|
||||
|
||||
<h3 id="adding-an-icon">Adding an icon</h3>
|
||||
|
||||
<p>Commands support adding icons to their menu item in addition to or instead of the display name of the command. To add an icon to your command, add the attribute <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandIconAttribute</code> to your command class. Currently you can use any of the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.imaging.knownmonikers?view=visualstudiosdk-2022">KnownMonikers</a> currently supported by Visual Studio. Custom monikers are not supported at this time.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Type</th>
|
||||
<th>Required</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ImageMoniker</td>
|
||||
<td>String</td>
|
||||
<td>Yes</td>
|
||||
<td>The name of any of the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.imaging.knownmonikers?view=visualstudiosdk-2022">KnownMonikers</a> currently supported by Visual Studio, with or without the <code class="language-plaintext highlighter-rouge">KnownMonikers</code> type name.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IconSettings</td>
|
||||
<td>IconSettings</td>
|
||||
<td>Yes</td>
|
||||
<td>Configures how the command will be displayed. For example <code class="language-plaintext highlighter-rouge">IconSettings.IconAndText</code> displays the icon alongside the command’s display name, whereas <code class="language-plaintext highlighter-rouge">IconSettings.IconOnly</code> will only show the command’s icon and not its DisplayName if parented to a toolbar.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">[</span><span class="nf">CommandIcon</span><span class="p">(</span><span class="s">"Extension"</span><span class="p">,</span> <span class="n">IconSettings</span><span class="p">.</span><span class="n">IconAndText</span><span class="p">)]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h3 id="controlling-command-visibility">Controlling command visibility</h3>
|
||||
|
||||
<p>The visibility of a command can be controlled by adding the attribute <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandVisibleWhenAttribute</code> to your command class. This attribute supports specifying an expression, defining a set of terms used in the expression, and what values those terms should be replaced with upon evaluation. Note: Term names and values are mapped to their index in the array. i.e. the term name at index 0 corresponds with the term value at that same index. The command would be visible when the expression evaluates to true, and invisible when it is false.</p>
|
||||
|
||||
<p>If this attribute is omitted from your command, the default is for the command to always be visible.</p>
|
||||
|
||||
<p>An example of such an expression can be seen here:</p>
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="c1">// This command would become visible when an editor for a file with any file extension is active.</span>
|
||||
<span class="p">[</span><span class="nf">CommandVisibleWhen</span><span class="p">(</span>
|
||||
<span class="n">expression</span><span class="p">:</span> <span class="s">"AnyFile"</span><span class="p">,</span>
|
||||
<span class="n">termNames</span><span class="p">:</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"AnyFile"</span> <span class="p">},</span>
|
||||
<span class="n">termValues</span><span class="p">:</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"ClientContext:Shell.ActiveEditorContentType=.+"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>To see more information on valid term values:</p>
|
||||
<ul>
|
||||
<li><a href="./../../Inside_the_SDK/Activation_Constraints.md/#rule-based-activation-constraints">Using rule based activation constraints</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="controlling-command-enableddisabled-state">Controlling command Enabled/Disabled state</h3>
|
||||
|
||||
<p>The visibility of a command can be controlled by adding the attribute <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandEnabledWhenAttribute</code> to your command class. This attribute supports specifying an expression, defining a set of terms used in the expression, and what values those terms should be replaced with upon evaluation. Note: Term names and values are mapped to their index in the array. i.e. the term name at index 0 corresponds with the term value at that same index. The command would be enabled when the expression evaluates to true, and disabled when it is false.</p>
|
||||
|
||||
<p>If this attribute is omitted from your command, the default is for the command to always be enabled. You can also automatically have your command be disabled if it is currently executing by setting <code class="language-plaintext highlighter-rouge">this.DisableDuringExecution = true;</code> in the constructor of your command class. Setting this property will override the enabled/disabled state defined by the <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandEnabledWhenAttribute</code> while the command is being executed.</p>
|
||||
|
||||
<p>An example of such an expression can be seen here:</p>
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="c1">// This command would become enabled when a solution is loaded in the IDE and a file with the file extension ".jpg", ".jpeg", or ".txt" is selected in the Solution Explorer.</span>
|
||||
<span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="n">expression</span><span class="p">:</span> <span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="n">termNames</span><span class="p">:</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"SolutionLoaded"</span><span class="p">,</span> <span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="n">termValues</span><span class="p">:</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"SolutionState:Exists"</span><span class="p">,</span> <span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>To see more information on valid term values:</p>
|
||||
<ul>
|
||||
<li><a href="./../../Inside_the_SDK/Activation_Constraints.md/#rule-based-activation-constraints">Using rule based activation constraints</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="localizing-a-command">Localizing a command</h3>
|
||||
|
||||
<p>The text displayed on a command can be localized by including <code class="language-plaintext highlighter-rouge">string-resources.json</code> files with your extension and formatting the DisplayName parameter with the ‘%’ character on either end in your <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Commands.CommandAttribute</code>.</p>
|
||||
|
||||
<p>Localized Command DisplayName</p>
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">[</span><span class="nf">Command</span><span class="p">(</span><span class="n">CommandName</span><span class="p">,</span> <span class="n">CommandId</span><span class="p">,</span> <span class="s">"%Microsoft.VisualStudio.MyExtension.SampleRemoteCommand.DisplayName%"</span><span class="p">,</span> <span class="n">placement</span><span class="p">:</span> <span class="n">KnownCommandPlacement</span><span class="p">.</span><span class="n">ToolsMenu</span><span class="p">)]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h4 id="string-resourcesjson">string-resources.json</h4>
|
||||
|
||||
<p>Your extension should provide a <code class="language-plaintext highlighter-rouge">string-resources.json</code> file for every language that your extension supports. This JSON file is a dictionary of key/value pairs where the key is a globally (all of Visual Studio) unique identifier for a string resource and the value is the localized string resource. These JSON files should be deployed with your extension under the “.vsextensionâ€<C3A2> directory, with each language you support being shipped in a folder matching the name of the locale i.e. “deâ€<C3A2> for German, “itâ€<C3A2> for Italian, etc. The <code class="language-plaintext highlighter-rouge">string-resources.json</code> deployed at the root of the “.vsextensionâ€<C3A2> directory is used as the default if your extension does not support the language that Visual Studio is currently set to. An example of what this directory structure would look like can be seen here:</p>
|
||||
|
||||
<p><img src="localizing-a-command.PNG" alt="Localization directory structure" title="Localization directory structure" /></p>
|
||||
|
||||
<p>string-resources.json sample:</p>
|
||||
<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="w"> </span><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"Microsoft.VisualStudio.MyExtension.SampleRemoteCommand.DisplayName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Sample Remote Command"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"Microsoft.VisualStudio.MyExtension.OutputWindowTest.DisplayName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Output Window Test"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre></div></div>
|
||||
:ET
|
|
@ -1,18 +0,0 @@
|
|||
I"œ<p>This site will help you write successful Visual Studio extensions and there’s something for absolute beginners to experts alike!</p>
|
||||
|
||||
<h2 id="pick-your-starting-point">Pick your starting point</h2>
|
||||
|
||||
<p>Based on your experience level, pick where to begin.</p>
|
||||
|
||||
<h3 id="learn-how-to-get-started">Learn how to get started</h3>
|
||||
|
||||
<p>If you are new to extension development, you want to start at the beginning to ensure you’re not missing any information up front. Head on over to the <a href="getting-started/">getting started guide</a>.</p>
|
||||
|
||||
<h3 id="walk-me-through-typical-scenarios">Walk me through typical scenarios</h3>
|
||||
|
||||
<p>Once you know the basics of the Visual Studio extensibility model, it is time to explore what type of features to extend. To do that, check out the <a href="recipes/">recipe section</a> for inspiration and step-by-step walkthroughs.</p>
|
||||
|
||||
<h3 id="publishing-the-finished-extension">Publishing the finished extension</h3>
|
||||
|
||||
<p>When you’ve written your extension, it is time to publish it. Whether you want to share it with just a few friends, your company, or the whole world, you want to check out the <a href="publish/">publishing section</a>.</p>
|
||||
:ET
|
|
@ -1,39 +0,0 @@
|
|||
I"¦<h1 id="out-of-process-extensibility-model-overview">Out-of-Process Extensibility Model Overview</h1>
|
||||
|
||||
<p>While the existing model loads extensions in-process, the new extensibility model brings Visual Studio extensions out-of-process. This out-of-proc model gives you the opportunity to create more reliable, secure, and easier-to-write extensions while still providing the in-depth functionality the old model provides. The following documentation describes:</p>
|
||||
|
||||
<ul>
|
||||
<li>The general architecture of the new extensibility model</li>
|
||||
<li>How to take advantage of the new extensibility model’s APIs</li>
|
||||
<li>How to compile and F5 debug an extension with the new model</li>
|
||||
<li>Resources and code samples to get started writing an extension with the new model</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="what-is-the-new-extensibility-model--why-should-you-use-it">What is the new extensibility model & why should you use it?</h2>
|
||||
|
||||
<p>The new, out-of-proc extensibility model aims to address many of the problems both developers experience when using and writing extensions in Visual Studio using the old model. These issues include:</p>
|
||||
|
||||
<ul>
|
||||
<li>Extension-caused crashes and hangs of Visual Studio and other installed extensions</li>
|
||||
<li>Inconsistent hard-to-find docs and APIs, tribal knowledge requirements, and overwhelming architecture</li>
|
||||
<li>Lack of secure extensions</li>
|
||||
<li>Having to restart Visual Studio when installing extensions</li>
|
||||
</ul>
|
||||
|
||||
<p>Writing extensions using the new model provides the following benefits:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>Increased reliability</strong> – Extensions written with the new model are out-of-proc and will not block the Visual Studio UI. This means that if the extension crashes, VS will not crash as a result.</li>
|
||||
<li><strong>Reduced API complexity</strong> – The new model’s wrapper API has been built from the ground-up to be more cohesive and simpler to implement while retaining the old model’s advanced functionality.</li>
|
||||
<li><strong>Low-trust extensions (Coming Soon)</strong> – Since extensions in the new model run in a separate process, they can be isolated from devenv and ran in a low-trust sandbox. This environment will provide the extensions with read-only access to the file system and controlled writing access via the model’s APIs.</li>
|
||||
<li><strong>Hot-reloading functionality (Coming Soon)</strong> – Excluding ones requiring VS component prerequisites that haven’t been installed yet, extensions written using the new model can be installed and loaded without needing to restart Visual Studio.</li>
|
||||
<li><strong>.NET Core Only</strong> – With VS transitioning primarily to .NET core, all new model extensions will be run on .NET core. All APIs will also be built on .NET core and will be .NET 6 compatible.</li>
|
||||
<li><strong>Cross-CPU Platform</strong> – Since APIs will be IServiceBroker and .NET core based, all Gladstone extensions will run on all CPU platforms supported by .net core runtime.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="next-steps">Next Steps</h2>
|
||||
|
||||
<p>To get started writing an extension using the new model, here are some docs, walkthroughs, samples, and videos to get you started:</p>
|
||||
|
||||
<p><strong>[TODO: Add links to docs here]</strong></p>
|
||||
:ET
|
|
@ -1,49 +0,0 @@
|
|||
I"õ<h1 id="walkthrough-insert-guid-extension-sample">Walkthrough: Insert Guid Extension Sample</h1>
|
||||
|
||||
<p>This extension is a simple extension that shows how a command that modifies an open editor window can be quickly added to Visual Studio.</p>
|
||||
|
||||
<p>Source code: TBD</p>
|
||||
|
||||
<h2 id="command-definition">Command definition</h2>
|
||||
|
||||
<p>The extension consist of a single code file that defines a command and its properties starting with class attributes as seen below:</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="p">[</span><span class="nf">Command</span><span class="p">(</span>
|
||||
<span class="s">"Microsoft.VisualStudio.InsertGuidExtension.InsertGuidCommand"</span><span class="p">,</span>
|
||||
<span class="m">1</span><span class="p">,</span>
|
||||
<span class="s">"Insert new guid"</span><span class="p">,</span>
|
||||
<span class="n">placement</span><span class="p">:</span> <span class="n">KnownCommandPlacement</span><span class="p">.</span><span class="n">ExtensionsMenu</span><span class="p">)]</span>
|
||||
<span class="p">[</span><span class="nf">CommandIcon</span><span class="p">(</span><span class="s">"OfficeWebExtension"</span><span class="p">,</span> <span class="n">IconSettings</span><span class="p">.</span><span class="n">IconAndText</span><span class="p">)]</span>
|
||||
<span class="p">[</span><span class="nf">CommandVisibleWhen</span><span class="p">(</span><span class="s">"AnyFile"</span><span class="p">,</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"AnyFile"</span> <span class="p">},</span> <span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"ClientContext:Shell.ActiveEditorContentType=.+"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The first <code class="language-plaintext highlighter-rouge">Command</code> attribute registers the command using the unique name <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.InsertGuidExtension.InsertGuidCommand</code> and id <code class="language-plaintext highlighter-rouge">1</code>. The command is placed in <code class="language-plaintext highlighter-rouge">Extensions</code> top menu and uses <code class="language-plaintext highlighter-rouge">OfficeWebExtension</code> icon moniker.</p>
|
||||
|
||||
<p><code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute defines when the command is visible in <code class="language-plaintext highlighter-rouge">Extensions</code> menu. You can refer to <a href="">Activation Constraints</a> to learn about different options that you can use to determine command visibility and state. In this case, the command is enabled anytime there is an active editor in the IDE.</p>
|
||||
|
||||
<h2 id="getting-the-active-editor-view">Getting the active editor view</h2>
|
||||
|
||||
<p>Once user executes the command, SDK will route execution to <code class="language-plaintext highlighter-rouge">ExecuteCommandAsync</code> method. <code class="language-plaintext highlighter-rouge">IClientContext</code> instance contains information about the state of IDE at the time of command execution and can be used in conjuction with <code class="language-plaintext highlighter-rouge">VisualStudioExtensibility</code> object.</p>
|
||||
|
||||
<p>In our example, we utilize <code class="language-plaintext highlighter-rouge">GetActiveTextViewAsync</code> method to get the active text view at the time of command execution which includes information about document being open, version of the document and the selection.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">using</span> <span class="nn">var</span> <span class="n">textView</span> <span class="p">=</span> <span class="k">await</span> <span class="n">context</span><span class="p">.</span><span class="nf">GetActiveTextViewAsync</span><span class="p">(</span><span class="n">cancellationToken</span><span class="p">);</span>
|
||||
</code></pre></div></div>
|
||||
<h2 id="mutating-the-text-in-active-view">Mutating the text in active view</h2>
|
||||
|
||||
<p>Once we have the active text view, we can mutate the document attached to the view to replace the selection with a new guid string as below.</p>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">var</span> <span class="n">document</span> <span class="p">=</span> <span class="k">await</span> <span class="n">textView</span><span class="p">.</span><span class="nf">GetTextDocumentAsync</span><span class="p">(</span><span class="n">cancellationToken</span><span class="p">);</span>
|
||||
<span class="k">await</span> <span class="k">this</span><span class="p">.</span><span class="n">Extensibility</span><span class="p">.</span><span class="nf">Editor</span><span class="p">().</span><span class="nf">MutateAsync</span><span class="p">(</span>
|
||||
<span class="n">m</span> <span class="p">=></span>
|
||||
<span class="p">{</span>
|
||||
<span class="kt">var</span> <span class="n">mutator</span> <span class="p">=</span> <span class="n">m</span><span class="p">.</span><span class="nf">GetMutator</span><span class="p">(</span><span class="n">document</span><span class="p">);</span>
|
||||
<span class="n">mutator</span><span class="p">.</span><span class="nf">Replace</span><span class="p">(</span><span class="n">textView</span><span class="p">.</span><span class="n">Selection</span><span class="p">.</span><span class="n">Extent</span><span class="p">,</span> <span class="n">newGuidString</span><span class="p">);</span>
|
||||
<span class="p">},</span>
|
||||
<span class="n">cancellationToken</span><span class="p">);</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="logging-errors">Logging errors</h2>
|
||||
|
||||
<p>Each extension part including command sets is assigned a <code class="language-plaintext highlighter-rouge">TraceSource</code> instance that can be utilized to log diagnostic errors. Please see <a href="../Inside_the_SDK/Logging.md">Logging</a> section for more information.</p>
|
||||
:ET
|
|
@ -1,9 +0,0 @@
|
|||
I"
|
||||
<h1 id="logging-extension-diagnostics">Logging extension diagnostics</h1>
|
||||
|
||||
<p>Each extension part can inject a <code class="language-plaintext highlighter-rouge">TraceSource</code> instance that is created as part of the extensibility framework. Extension developers are strongly recommended to utilize this instance for diagnostics as it will allow integration with future tools on Visual Studio diagnostics.</p>
|
||||
|
||||
<h2 id="accessing-log-entries">Accessing log entries</h2>
|
||||
|
||||
<p>Currently the logs are output to <code class="language-plaintext highlighter-rouge">%TEMP%\VSLogs</code> directory in <code class="language-plaintext highlighter-rouge">svclog</code> XML format. This format allows logs from multiple processes to be correlated to each other and can be opened by <a href="https://docs.microsoft.com/en-us/dotnet/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe">Microsoft Service Trace Viewer</a> tool. This tool should already be available on machines with Visual Studio as it is part of .Net Framework tools.</p>
|
||||
:ET
|
|
@ -1,83 +0,0 @@
|
|||
I"`<h1 id="creating-your-first-visual-studio-out-of-process-extension">Creating your first Visual Studio Out-of-Process extension</h1>
|
||||
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Visual Studio 2022 Preview 3 with managed languages workload.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Visual Studio Extensibility Project Extension: This extension will allow you to debug extension projects using F5. There is currently no other deployment mechanism supported.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="create-the-extension-project">Create the extension project</h2>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The extensibility APIs are distributed via nuget packages, so you can start with an empty .NET 6.0 C# class library project.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once project is created change <code class="language-plaintext highlighter-rouge">TargetFramework</code> from <code class="language-plaintext highlighter-rouge">net6.0</code> to <code class="language-plaintext highlighter-rouge">net6.0-windows</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Add references to <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility</code> and <code class="language-plaintext highlighter-rouge">Microsoft.VisualStudio.Extensibility.Build</code> packages.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>At this point you are ready to start extending Visual Studio by adding commands and editor components to your extension.</p>
|
||||
|
||||
<h2 id="add-a-command-handler">Add a command handler</h2>
|
||||
|
||||
<ul>
|
||||
<li>Create a new <code class="language-plaintext highlighter-rouge">.cs</code> file and include the following code:</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">namespace</span> <span class="nn">SimpleRemoteCommandSample</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">using</span> <span class="nn">System.Diagnostics</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">System.Threading</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">System.Threading.Tasks</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">Microsoft</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">Microsoft.VisualStudio.Extensibility</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">Microsoft.VisualStudio.Extensibility.Commands</span><span class="p">;</span>
|
||||
<span class="k">using</span> <span class="nn">Microsoft.VisualStudio.Extensibility.Definitions</span><span class="p">;</span>
|
||||
|
||||
<span class="p">[</span><span class="nf">CommandIcon</span><span class="p">(</span><span class="s">"Extension"</span><span class="p">,</span> <span class="n">IconSettings</span><span class="p">.</span><span class="n">IconAndText</span><span class="p">)]</span>
|
||||
<span class="p">[</span><span class="nf">Command</span><span class="p">(</span>
|
||||
<span class="s">"SimpleRemoteCommandSample.Command"</span><span class="p">,</span>
|
||||
<span class="m">1</span> <span class="cm">/* command id */</span><span class="p">,</span>
|
||||
<span class="s">"Sample Remote Command"</span><span class="p">,</span>
|
||||
<span class="n">placement</span><span class="p">:</span> <span class="n">KnownCommandPlacement</span><span class="p">.</span><span class="n">ToolsMenu</span><span class="p">)]</span>
|
||||
<span class="k">public</span> <span class="k">class</span> <span class="nc">CommandHandler</span> <span class="p">:</span> <span class="n">Command</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">private</span> <span class="n">TraceSource</span> <span class="n">traceSource</span><span class="p">;</span>
|
||||
|
||||
<span class="k">public</span> <span class="nf">CommandHandler</span><span class="p">(</span><span class="n">VisualStudioExtensibility</span> <span class="n">extensibility</span><span class="p">,</span> <span class="n">TraceSource</span> <span class="n">traceSource</span><span class="p">,</span> <span class="kt">ushort</span> <span class="n">id</span><span class="p">)</span>
|
||||
<span class="p">:</span> <span class="k">base</span><span class="p">(</span><span class="n">extensibility</span><span class="p">,</span> <span class="n">id</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">this</span><span class="p">.</span><span class="n">traceSource</span> <span class="p">=</span> <span class="n">Requires</span><span class="p">.</span><span class="nf">NotNull</span><span class="p">(</span><span class="n">traceSource</span><span class="p">,</span> <span class="k">nameof</span><span class="p">(</span><span class="n">traceSource</span><span class="p">));</span>
|
||||
<span class="p">}</span>
|
||||
|
||||
<span class="k">public</span> <span class="k">override</span> <span class="n">Task</span> <span class="nf">ExecuteCommandAsync</span><span class="p">(</span><span class="n">IClientContext</span> <span class="n">context</span><span class="p">,</span> <span class="n">CancellationToken</span> <span class="n">cancellationToken</span><span class="p">)</span>
|
||||
<span class="p">{</span>
|
||||
<span class="k">this</span><span class="p">.</span><span class="n">traceSource</span><span class="p">.</span><span class="nf">TraceInformation</span><span class="p">(</span><span class="s">$"Executing command </span><span class="p">{</span><span class="n">CommandName</span><span class="p">}</span><span class="s">"</span><span class="p">);</span>
|
||||
<span class="k">return</span> <span class="n">Task</span><span class="p">.</span><span class="n">CompletedTask</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>For more information on how to add commands, please refer to <code class="language-plaintext highlighter-rouge">TBD</code>.</p>
|
||||
|
||||
<h2 id="debug-your-extension">Debug your extension</h2>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Making sure that your extension project is selected as startup projet in Visual Studio, press <code class="language-plaintext highlighter-rouge">F5</code> to start debugging.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>This will build your extension and deploy it to experimental instance of Visual Studio version your are using. The debugger should attach once your extension is loaded.</p>
|
||||
</li>
|
||||
</ul>
|
||||
:ET
|
|
@ -1,8 +0,0 @@
|
|||
I"
<h1 id="announcements">Announcements</h1>
|
||||
<p>Use this page to stay up-to-date on all upcoming extensibility announcements and critical SDK/API updates.</p>
|
||||
|
||||
<h2 id="august-26-2021">August 26, 2021</h2>
|
||||
<ul>
|
||||
<li>VSExtensibility site/repository goes public!</li>
|
||||
</ul>
|
||||
:ET
|
|
@ -1,375 +0,0 @@
|
|||
I"Tk<h1 id="visual-studio-extensions-to-the-language-server-protocol">Visual Studio extensions to the Language Server Protocol</h1>
|
||||
|
||||
<p>This document describes the Visual Studio specific extensions to the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/">Language Server Protocol</a>. These extensions can be used by servers to provide additional functionalities when communicating with a Visual Studio instance.</p>
|
||||
|
||||
<p>These extensions are composed of:</p>
|
||||
<ol>
|
||||
<li>Classes which extend base classes from the LSP specification allowing to provide additional information to Visual Studio. For example <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> adding support for tooltips, sorting, etc.</li>
|
||||
<li>Additional methods like <a href="#getprojectcontexts">GetProjectContexts</a>. These are listed in <a href="#vsmethods"><code class="language-plaintext highlighter-rouge">VSMethods</code></a>.</li>
|
||||
<li>Additional capabilities that a language server can provide to the Visual Studio client. These are defined in <a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">VSServerCapabilities</code></a> and can be communicated to the client in the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#initializeResult"><code class="language-plaintext highlighter-rouge">InitializeResult.capabilities</code></a> field of the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#initialize"><code class="language-plaintext highlighter-rouge">initialize</code></a> request.</li>
|
||||
<li>Additional values for enumerations described in the LSP protocol. For example <a href="#vsdiagnostictag"><code class="language-plaintext highlighter-rouge">VSDiagnosticTag</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnosticTag"><code class="language-plaintext highlighter-rouge">DiagnosticTag</code></a>.</li>
|
||||
</ol>
|
||||
|
||||
<p>A .NET implementation of these extensions can be found on <a href="https://www.nuget.org/packages/Microsoft.VisualStudio.LanguageServer.Protocol.Extensions">NuGet</a>.</p>
|
||||
|
||||
<p>When using this package in a language server, configure the <code class="language-plaintext highlighter-rouge">JsonSerializer</code> using <code class="language-plaintext highlighter-rouge">VSExtensionUtilities.AddVSExtensionConverters</code> in order to allow extensions classes to be correctly deserialized. For example, this allows the <code class="language-plaintext highlighter-rouge">JsonSerializer</code> to correctly deserialize the <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction"><code class="language-plaintext highlighter-rouge">CodeAction.Diagnostics</code></a> entries of a <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction_resolve"><code class="language-plaintext highlighter-rouge">codeAction/resolve</code></a> request into <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> objects even if <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeAction"><code class="language-plaintext highlighter-rouge">CodeAction.Diagnostics</code></a> is defined as an array of <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> objects.</p>
|
||||
|
||||
<h1 id="new-methods">New methods</h1>
|
||||
|
||||
<h2 id="getprojectcontexts">GetProjectContexts</h2>
|
||||
|
||||
<p><em>GetProjectContexts</em> requests are sent from the client to the server to retrieve a list of the project contexts associated with a text document. An example of project contexts are <a href="https://docs.microsoft.com/en-us/dotnet/standard/frameworks#how-to-specify-a-target-framework">multiple target frameworks</a> in SDK style .NET projects.</p>
|
||||
|
||||
<p>The labels of all project contexts are presented to the user in the navigation bar at the top of the document. When the user changes the project context in the navigation bar, the active project context is changed.</p>
|
||||
|
||||
<p>The client includes the active project context in requests to the server by filling in the <a href="#vstextdocumentidentifier"><code class="language-plaintext highlighter-rouge">VSTextDocumentIdentifier._vs_projectContext</code></a> property.</p>
|
||||
|
||||
<p><em>Server Capability</em></p>
|
||||
|
||||
<ul>
|
||||
<li>property path (optional): <a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">_vs_projectContextProvider</code></a></li>
|
||||
<li>property type: <code class="language-plaintext highlighter-rouge">boolean</code></li>
|
||||
</ul>
|
||||
|
||||
<p><em>Request</em></p>
|
||||
|
||||
<ul>
|
||||
<li>method: <code class="language-plaintext highlighter-rouge">textDocument/_vs_getProjectContexts</code></li>
|
||||
<li>params: <a href="#vsgetprojectcontextsparams"><code class="language-plaintext highlighter-rouge">VSGetProjectContextsParams</code></a></li>
|
||||
</ul>
|
||||
|
||||
<p><em>Response</em></p>
|
||||
|
||||
<ul>
|
||||
<li>result: <a href="#vsprojectcontextlist"><code class="language-plaintext highlighter-rouge">VSProjectContextList</code></a></li>
|
||||
</ul>
|
||||
|
||||
<h1 id="extensions-specification">Extensions specification</h1>
|
||||
|
||||
<h2 id="vsdiagnostic">VSDiagnostic</h2>
|
||||
|
||||
<p><a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">Diagnostic</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSDiagnostic</span> <span class="kd">extends</span> <span class="nx">Diagnostic</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project and context (e.g. Win32, MacOS, etc.) in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projects</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSDiagnosticProjectInformation</span><span class="p">[],</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets an expanded description of the diagnostic.
|
||||
**/</span>
|
||||
<span class="nx">_vs_expandedMessage</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a message shown when the user hovers over an error. If null, then Diagnostic.message
|
||||
* is used (use VSDiagnosticTags.SuppressEditorToolTip to prevent a tool tip from being shown).
|
||||
**/</span>
|
||||
<span class="nx">_vs_toolTip</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a non-human-readable identier allowing consolidation of multiple equivalent diagnostics
|
||||
* (e.g. the same syntax error from builds targeting different platforms).
|
||||
**/</span>
|
||||
<span class="nx">_vs_identifier</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a string describing the diagnostic types (e.g. Security, Performance, Style, etc.).
|
||||
**/</span>
|
||||
<span class="nx">_vs_diagnosticType</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a rank associated with this diagnostic, used for the default sort.
|
||||
* VSDiagnosticRank.Default will be used if no rank is specified.
|
||||
**/</span>
|
||||
<span class="nx">_vs_diagnosticRank</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSDiagnosticRank</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets an ID used to associate this diagnostic with a corresponding line in the output window.
|
||||
**/</span>
|
||||
<span class="nx">_vs_outputId</span><span class="p">?</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnosticprojectinformation">VSDiagnosticProjectInformation</h2>
|
||||
|
||||
<p><a href="#vsdiagnosticprojectinformation"><code class="language-plaintext highlighter-rouge">VSDiagnosticProjectInformation</code></a> represents the project and context in which the <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> is generated.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSDiagnosticProjectInformation</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a human-readable identifier for the project in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectName</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a human-readable identifier for the build context (e.g. Win32 or MacOS)
|
||||
* in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nx">_vs_context</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the unique identifier for the project in which the diagnostic was generated.
|
||||
**/</span>
|
||||
<span class="nx">_vs_projectIdentifier</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnosticrank">VSDiagnosticRank</h2>
|
||||
|
||||
<p><a href="#vsdiagnosticrank"><code class="language-plaintext highlighter-rouge">VSDiagnosticRank</code></a> represents the rank of a <a href="#vsdiagnostic"><code class="language-plaintext highlighter-rouge">VSDiagnostic</code></a> object.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">enum</span> <span class="nx">VSDiagnosticRank</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Highest priority.
|
||||
**/</span>
|
||||
<span class="nx">Highest</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* High priority.
|
||||
**/</span>
|
||||
<span class="nx">High</span> <span class="o">=</span> <span class="mi">200</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Default priority.
|
||||
**/</span>
|
||||
<span class="nx">Default</span> <span class="o">=</span> <span class="mi">300</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Low priority.
|
||||
**/</span>
|
||||
<span class="nx">Low</span> <span class="o">=</span> <span class="mi">400</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Lowest priority.
|
||||
**/</span>
|
||||
<span class="nx">Lowest</span> <span class="o">=</span> <span class="mi">500</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsdiagnostictags">VSDiagnosticTags</h2>
|
||||
|
||||
<p>Additional <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">DiagnosticTag</code></a> values that are specific to Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="k">namespace</span> <span class="nx">VSDiagnosticTags</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry generated by the build.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">BuildError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry generated by Intellisense.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">IntellisenseError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">2</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry that could be generated from both builds
|
||||
* and Intellisense.
|
||||
*
|
||||
* Diagnostic entries tagged with VSDiagnosticTags.PotentialDuplicate will be hidden
|
||||
* in the error list if the error list is displaying build and intellisense
|
||||
* errors.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">PotentialDuplicate</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">3</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* A Diagnostic entry is never displayed in the error list.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">HiddenInErrorList</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">4</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is always displayed in the error list.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">VisibleInErrorList</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">5</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is never displayed in the editor.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">HiddenInEditor</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">6</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* No tooltip is shown for the Diagnostic entry in the editor.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">SuppressEditorToolTip</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">7</span><span class="p">;</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* The Diagnostic entry is represented in the Editor as an Edit
|
||||
* and Continue error.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">EditAndContinueError</span> <span class="p">:</span> <span class="nx">DiagnosticTag</span> <span class="o">=</span> <span class="o">-</span><span class="mi">8</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsgetprojectcontextsparams">VSGetProjectContextsParams</h2>
|
||||
|
||||
<p><a href="#vsgetprojectcontextsparams"><code class="language-plaintext highlighter-rouge">VSGetProjectContextsParams</code></a> represents the parameter that is sent with the ‘textDocument/_vs_getProjectContexts’ request.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSGetProjectContextsParams</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the document for which project contexts are queried.
|
||||
**/</span>
|
||||
<span class="nl">_vs_textDocument</span> <span class="p">:</span> <span class="nx">TextDocumentItem</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsimageid">VSImageId</h2>
|
||||
|
||||
<p><a href="#vsimageid"><code class="language-plaintext highlighter-rouge">VSImageId</code></a> represents the unique identifier for a Visual Studio image asset. The identified is composed by a <a href="#vsimageid"><code class="language-plaintext highlighter-rouge">VSImageId._vs_guid</code></a> and an integer. A list of valid image ids can be retrieved from the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.imaging.knownmonikers">KnownMonikers class</a> from the Visual Studio SDK.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSImageId</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the VSImageId._vs_guid component of the unique identifier.
|
||||
**/</span>
|
||||
<span class="nl">_vs_guid</span> <span class="p">:</span> <span class="nx">Guid</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the integer component of the unique identifier.
|
||||
**/</span>
|
||||
<span class="nx">_vs_id</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vslocation">VSLocation</h2>
|
||||
|
||||
<p><a href="#vslocation"><code class="language-plaintext highlighter-rouge">VSLocation</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">Location</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSLocation</span> <span class="kd">extends</span> <span class="nx">Location</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project name to be displayed to user.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectName</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the text value for the display path.
|
||||
* In case the actual path on disk would be confusing for users, this should be a friendly display name.
|
||||
* This doesn't have to correspond to a real file path, but must be parsable by the System.IO.Path.GetFileName(System.String) method.
|
||||
**/</span>
|
||||
<span class="nx">_vs_displayPath</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsmethods">VSMethods</h2>
|
||||
|
||||
<p><a href="#vsmethods"><code class="language-plaintext highlighter-rouge">VSMethods</code></a> contains the string values for all Language Server Protocol Visual Studio specific methods.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="k">namespace</span> <span class="nx">VSMethods</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Method name for 'textDocument/_vs_getProjectContexts'.
|
||||
* The 'textDocument/_vs_getProjectContexts' request is sent from the client to the server to query
|
||||
* the list of project context associated with a document.
|
||||
* This method has a parameter of type VSGetProjectContextsParams and a return value of type
|
||||
* VSProjectContextList.
|
||||
* In order to enable the client to send the 'textDocument/_vs_getProjectContexts' requests, the server must
|
||||
* set the VSServerCapabilities._vs_projectContextProvider property.
|
||||
**/</span>
|
||||
<span class="k">export</span> <span class="kd">const</span> <span class="nx">GetProjectContextsName</span> <span class="p">:</span> <span class="kr">string</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">textDocument/_vs_getProjectContexts</span><span class="dl">'</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectcontext">VSProjectContext</h2>
|
||||
|
||||
<p><a href="#vsprojectcontext"><code class="language-plaintext highlighter-rouge">VSProjectContext</code></a> represents a project context.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSProjectContext</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the label for the project context.
|
||||
**/</span>
|
||||
<span class="nl">_vs_label</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the unique identifier of the project context.
|
||||
**/</span>
|
||||
<span class="nx">_vs_id</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the context kind of the project context which is used to determine its associated icon.
|
||||
**/</span>
|
||||
<span class="nx">_vs_kind</span> <span class="p">:</span> <span class="nx">VSProjectKind</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectcontextlist">VSProjectContextList</h2>
|
||||
|
||||
<p><a href="#vsprojectcontextlist"><code class="language-plaintext highlighter-rouge">VSProjectContextList</code></a> represents the response to the ‘textDocument/_vs_getProjectContexts’ request.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSProjectContextList</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the document contexts associated with a text document.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContexts</span> <span class="p">:</span> <span class="nx">VSProjectContext</span><span class="p">[],</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the index of the default entry of the VSProjectContext array.
|
||||
**/</span>
|
||||
<span class="nx">_vs_defaultIndex</span> <span class="p">:</span> <span class="nx">integer</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsprojectkind">VSProjectKind</h2>
|
||||
|
||||
<p><a href="#vsprojectkind"><code class="language-plaintext highlighter-rouge">VSProjectKind</code></a> represents the various kinds of contexts.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">enum</span> <span class="nx">VSProjectKind</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* C++ project.
|
||||
**/</span>
|
||||
<span class="nx">CPlusPlus</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* C# project.
|
||||
**/</span>
|
||||
<span class="nx">CSharp</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Visual Basic project.
|
||||
**/</span>
|
||||
<span class="nx">VisualBasic</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vsservercapabilities">VSServerCapabilities</h2>
|
||||
|
||||
<p><a href="#vsservercapabilities"><code class="language-plaintext highlighter-rouge">VSServerCapabilities</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">ServerCapabilities</code></a> allowing to provide additional capabilities supported by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSServerCapabilities</span> <span class="kd">extends</span> <span class="nx">ServerCapabilities</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets a value indicating whether the server supports the
|
||||
* 'textDocument/_vs_getProjectContexts' request.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContextProvider</span><span class="p">?</span> <span class="p">:</span> <span class="nx">boolean</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vssymbolinformation">VSSymbolInformation</h2>
|
||||
|
||||
<p><a href="#vssymbolinformation"><code class="language-plaintext highlighter-rouge">VSSymbolInformation</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">SymbolInformation</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSSymbolInformation</span> <span class="kd">extends</span> <span class="nx">SymbolInformation</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the icon associated with the symbol. If specified, this icon is used instead of SymbolKind.
|
||||
**/</span>
|
||||
<span class="nl">_vs_icon</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSImageId</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the description of the symbol.
|
||||
**/</span>
|
||||
<span class="nx">_vs_description</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the hint text for the symbol.
|
||||
**/</span>
|
||||
<span class="nx">_vs_hintText</span><span class="p">?</span> <span class="p">:</span> <span class="kr">string</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="vstextdocumentidentifier">VSTextDocumentIdentifier</h2>
|
||||
|
||||
<p><a href="#vstextdocumentidentifier"><code class="language-plaintext highlighter-rouge">VSTextDocumentIdentifier</code></a> extends <a href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/"><code class="language-plaintext highlighter-rouge">TextDocumentIdentifier</code></a> providing additional properties used by Visual Studio.</p>
|
||||
<div class="language-typescript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">export</span> <span class="kr">interface</span> <span class="nx">VSTextDocumentIdentifier</span> <span class="kd">extends</span> <span class="nx">TextDocumentIdentifier</span> <span class="p">{</span>
|
||||
|
||||
<span class="cm">/**
|
||||
* Gets or sets the project context of the text document.
|
||||
**/</span>
|
||||
<span class="nl">_vs_projectContext</span><span class="p">?</span> <span class="p">:</span> <span class="nx">VSProjectContext</span><span class="p">,</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div></div>
|
||||
:ET
|
|
@ -1,171 +0,0 @@
|
|||
I"ã<h1 id="rule-based-activation-constraints">Rule based activation constraints</h1>
|
||||
|
||||
<p>One of the common concepts in Visual Studio Extensibility SDK is use of context based activation rules in code attributes. An example of these would <code class="language-plaintext highlighter-rouge">CommandVisibleWhen</code> attribute declaring when a command is made visible.</p>
|
||||
|
||||
<p>Our goal is to provide a common way to create such contexts, the current method is based on existing <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-rule-based-ui-context-for-visual-studio-extensions">Rule-based UI contexts</a> with a different set of context terms.</p>
|
||||
|
||||
<h2 id="constraint-attribute-arguments">Constraint attribute arguments</h2>
|
||||
|
||||
<p>Each constraint attribute will contain at least 3 required arguments that defines the expression:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Expression string: A boolean expression using <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations and term names that are defined in later arguments. Each term must be a single word (without spaces) and expression can utilize parantheses for grouping and <code class="language-plaintext highlighter-rouge">&</code>, <code class="language-plaintext highlighter-rouge">|</code>, <code class="language-plaintext highlighter-rouge">!</code> operators for <code class="language-plaintext highlighter-rouge">and</code>, <code class="language-plaintext highlighter-rouge">or</code>, <code class="language-plaintext highlighter-rouge">not</code> operations.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term names: An array that contains the name of the terms used in the expression above.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Term definitions: An array that defines the each term in the order terms are defined in the names array above.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="example-definition">Example definition</h2>
|
||||
|
||||
<p>In the example below, the code attributes defines when a command is in enabled state.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The expression indicates that command is enabled when both <code class="language-plaintext highlighter-rouge">SolutionLoaded</code> and <code class="language-plaintext highlighter-rouge">IsValidFile</code> terms are true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">SolutionLoaded</code> term is defined as <code class="language-plaintext highlighter-rouge">SolutionState:Exists</code> which indicates, the term evaluates to <code class="language-plaintext highlighter-rouge">true</code> when a solution exists in the IDE.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="language-plaintext highlighter-rouge">IsValidFile</code> term is true when selected file in Solution Explorer is a jpeg or text file as defined by the file extension.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="language-csharp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="nf">CommandEnabledWhen</span><span class="p">(</span>
|
||||
<span class="s">"SolutionLoaded & IsValidFile"</span><span class="p">,</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionLoaded"</span><span class="p">,</span>
|
||||
<span class="s">"IsValidFile"</span> <span class="p">},</span>
|
||||
<span class="k">new</span> <span class="kt">string</span><span class="p">[]</span> <span class="p">{</span>
|
||||
<span class="s">"SolutionState:Exists"</span><span class="p">,</span>
|
||||
<span class="s">"ClientContext:Shell.ActiveSelectionFileName=(.jpg|.jpeg|.txt)$"</span> <span class="p">})]</span>
|
||||
</code></pre></div></div>
|
||||
|
||||
<h2 id="available-terms">Available terms</h2>
|
||||
|
||||
<p>Following is the list of terms currently supported by expression engine.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Term</th>
|
||||
<th>Description</th>
|
||||
<th>Â </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SolutionHasProjectBuildProperty:<property>=<regex></td>
|
||||
<td>The term is true when solution has a loaded project with the specified build property and property value matches to regex filter provided.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectCapability:<expression></td>
|
||||
<td>True whenever solution has a project with capabilities matching the provided sub-expression. An expression can be something like VB</td>
|
||||
<td>CSharp.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionHasProjectFlavor:<guid></td>
|
||||
<td>True whenever a solution has project that is flavored (aggregated) and has a flavor matching the given project type GUID.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SolutionState:<state></td>
|
||||
<td>True when solution state matches to provided value, see <a href="#solution-states">solution states</a> for list of values.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProjectAddedItem:<pattern></td>
|
||||
<td>The term is true when a file matching the “patternâ€<C3A2> is added to a project in the solution that is opened.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ClientContext:<key>=<pattern></td>
|
||||
<td>True when the provided client context key matches to regular expression. See <a href="#client-contexts">client contexts</a> for more details.</td>
|
||||
<td>Â </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="solution-states">Solution states</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NoSolution</td>
|
||||
<td>No solution loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exists</td>
|
||||
<td>A solution is opened but may be in loaded or loading state.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FullyLoaded</td>
|
||||
<td>A solution is opened and fully loaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Empty</td>
|
||||
<td>Solution contains no projects but may contain solution items.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SingleProject</td>
|
||||
<td>Solution contains a single project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MultipleProject</td>
|
||||
<td>Solution contains multiple projects.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building</td>
|
||||
<td>Solution is building.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 id="client-contexts">Client contexts</h2>
|
||||
<p>Activation rules can also utilize the <a href="ExtensionAnatomy.md#client-context">client context</a> contents as parts of its expression.</p>
|
||||
|
||||
<p>Currently, the client context is limited to a small set of values in IDE state:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Context key</th>
|
||||
<th>Definition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionUri</td>
|
||||
<td>Full URI for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionPath</td>
|
||||
<td>Full path for the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveSelectionFileName</td>
|
||||
<td>File name of the selected item in solution explorer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorContentType</td>
|
||||
<td>Content type of the active editor view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shell.ActiveEditorFileName</td>
|
||||
<td>File name for the document that belongs to active editor view.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
:ET
|
11
docs/404.md
11
docs/404.md
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
title: 404 Page not found
|
||||
description: You got the wrong URL.
|
||||
date: 2021-6-16
|
||||
permalink: /404.html
|
||||
---
|
||||
|
||||
## Ooops
|
||||
The page you are looking for could not be found. It might have been renamed or moved.
|
||||
|
||||
Try finding it from the menu.
|
11
docs/Gemfile
11
docs/Gemfile
|
@ -1,11 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
# gem "rails"
|
||||
|
||||
gem "jekyll", "~> 4.2"
|
||||
|
||||
gem "webrick", "~> 1.7"
|
|
@ -1,69 +0,0 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.1.9)
|
||||
em-websocket (0.5.2)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
eventmachine (1.2.7-x64-mingw32)
|
||||
ffi (1.15.3-x64-mingw32)
|
||||
forwardable-extended (2.6.0)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.2.0)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (~> 2.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.4.0)
|
||||
pathutil (~> 0.9)
|
||||
rouge (~> 3.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (~> 2.0)
|
||||
jekyll-sass-converter (2.1.0)
|
||||
sassc (> 2.0.1, < 3.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
kramdown (2.3.1)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.3)
|
||||
listen (3.6.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.6)
|
||||
rb-fsevent (0.11.0)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.5)
|
||||
rouge (3.26.0)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.4.0-x64-mingw32)
|
||||
ffi (~> 1.9)
|
||||
terminal-table (2.0.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
unicode-display_width (1.7.0)
|
||||
webrick (1.7.0)
|
||||
|
||||
PLATFORMS
|
||||
x64-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
jekyll (~> 4.2)
|
||||
webrick (~> 1.7)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.25
|
|
@ -1,16 +0,0 @@
|
|||
title: Visual Studio Extensibility
|
||||
description: Visual Studio Extensibility
|
||||
#theme: jekyll-theme-tactile
|
||||
layout: default
|
||||
|
||||
css:
|
||||
syntax: true
|
||||
|
||||
defaults:
|
||||
- scope:
|
||||
path: ""
|
||||
values:
|
||||
layout: default
|
||||
|
||||
sass:
|
||||
style: compressed
|
|
@ -1,142 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
|
||||
<title>{{ page.title }} | {{ site.title }}</title>
|
||||
<meta name="description" content="{{ page.description }}" />
|
||||
<link rel="stylesheet" href="/assets/css/style.css" />
|
||||
<link rel=apple-touch-icon href="/assets/img/icon-180x180.png" />
|
||||
<link rel=icon type=image/png sizes=32x32 href="/assets/img/icon-32x32.png" />
|
||||
<link rel=icon type=image/png sizes=16x16 href="/assets/img/icon-16x16.png" />
|
||||
<link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="{{ site.title }}" />
|
||||
<meta property="og:title" content="{{ page.title }}" />
|
||||
<meta property="og:description" content="{{ page.description }}" />
|
||||
<meta property="og:url" content="{{ site.url }}{{ site.baseurl }}{{ page.url }}" />
|
||||
<meta property="og:image" content="{{ site.url }}{{ site.baseurl }}/assets/img/icon-180x180.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<h1>{{ page.title }}</h1>
|
||||
<a href="/">{{ site.description }}</a>
|
||||
</header>
|
||||
<main>
|
||||
<nav id="menu">
|
||||
<label for="hamburger">☰</label>
|
||||
<input type="checkbox" id="hamburger" />
|
||||
<ul>
|
||||
<li><a href="/" tabindex="0">Home</a></li>
|
||||
<li class="parent">
|
||||
<a href="/announcements.html">Announcements</a>
|
||||
</li>
|
||||
<li class="parent">
|
||||
<a href="/new-extensibility-model/" aria-haspopup="menu">Out-of-Proc Extensibility</a>
|
||||
<ul>
|
||||
<li class="parent">
|
||||
<a href="/new-extensibility-model/getting-started/" aria-haspopup="menu">Getting Started</a>
|
||||
<ul>
|
||||
<li><a href="/new-extensibility-model/getting-started/oop-extensibility-model-overview.html">What is Out-of-Process Extensibility?</a></li>
|
||||
<li><a href="/new-extensibility-model/getting-started/create-your-first-extension.html">Create your first OOP Extension</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="parent">
|
||||
<a href="/new-extensibility-model/extension-guides/" aria-haspopup="menu">Extension Guides</a>
|
||||
<ul>
|
||||
<li><a href="/new-extensibility-model/extension-guides/command/command.html">Extension Commands</a></li>
|
||||
<li><a href="/new-extensibility-model/extension-guides/editor/editor.html">Editor-based Extensions</a></li>
|
||||
<li><a href="/new-extensibility-model/extension-guides/insert-guid-sample.html">Walkthrough: Writing an Insert GUID Extension</a></li>
|
||||
<li><a href="/new-extensibility-model/extension-guides/markdown-linter-sample.html">Walkthrough: Writing a Markdown Linter Extension</a></li>
|
||||
</ul>
|
||||
<li class="parent">
|
||||
<a href="/new-extensibility-model/inside-the-sdk/inside-the-sdk.html" aria-haspopup="menu">Inside the SDK</a>
|
||||
<ul>
|
||||
<li><a href="/new-extensibility-model/inside-the-sdk/extension-anatomy.html">Extension Anatomy</a></li>
|
||||
<li><a href="/new-extensibility-model/inside-the-sdk/inside-the-sdk.html">Inside the SDK</a></li>
|
||||
<li><a href="/new-extensibility-model/inside-the-sdk/activation-constraints.html">Activation Constraints</a></li>
|
||||
<li><a href="/new-extensibility-model/inside-the-sdk/logging.html">Logging Extension Diagnostics</a></li>
|
||||
</ul>
|
||||
<li class="parent">
|
||||
<a href="/new-extensibility-model/api/" aria-haspopup="menu">API</a>
|
||||
<ul>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.html">Microsoft.VisualStudio.Extensibility</a></li>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.Framework.html">Microsoft.VisualStudio.Extensibility.Framework</a></li>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.Contracts.html">Microsoft.VisualStudio.Extensibility.Contracts</a></li>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.Editor.html">Microsoft.VisualStudio.Extensibility.Editor</a></li>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.Extensibility.EditorHostService.html">Microsoft.VisualStudio.Extensibility.EditorHostService</a></li>
|
||||
<li><a href="/new-extensibility-model/api/Microsoft.VisualStudio.ProjectSystem.Query.html">Microsoft.VisualStudio.ProjectSystem.Query</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="parent">
|
||||
<a href="/lsp/" aria-haspopup="menu">Language Server Protocol</a>
|
||||
<ul>
|
||||
<li><a href="/lsp/lsp-extensions-specification.html">VS Extensions to LSP</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
{{ content }}
|
||||
{% if page.date %}
|
||||
<div class="meta">Last updated: <time datetime="{{ page.date }}">{{ page.date | date_to_string: "ordinal",
|
||||
"US" }}</time></div>
|
||||
{% endif %}
|
||||
</article>
|
||||
</main>
|
||||
<footer>
|
||||
<ul>
|
||||
<li><a rel="noopener" href="https://github.com/microsoft/VSExtensibility/"
|
||||
target="_blank">VSExtensibility Repo</a></li>
|
||||
<!-- <li><a rel="noopener" href="https://github.com/VSExtensibility/Community.VisualStudio.Toolkit/discussions"
|
||||
target="_blank">Ask for help</a></li> -->
|
||||
<li><a rel="noopener" href="https://github.com/microsoft/VSExtensibility/issues" target="_blank">Report issues</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <p>Made with <strong>❤</strong> by fellow extenders</p> -->
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
window.requestAnimationFrame(function (e) {
|
||||
|
||||
// Expand menu on load
|
||||
var navLinks = document.querySelectorAll("nav a");
|
||||
navLinks.forEach(function (a) {
|
||||
if (location.pathname.endsWith(a.pathname)) {
|
||||
a.setAttribute("aria-current", "page")
|
||||
if (a.parentNode && a.parentNode.parentNode) {
|
||||
a.parentNode.classList.add("open");
|
||||
a.parentNode.parentNode.parentNode.classList.add("open");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Open menu items on click
|
||||
var menu = document.getElementById("menu");
|
||||
menu.addEventListener("click", function (e) {
|
||||
if (e.target.nextElementSibling !== null && e.target.tagName === "A") {
|
||||
e.preventDefault();
|
||||
e.target.parentNode.classList.toggle("open")
|
||||
}
|
||||
});
|
||||
|
||||
// Display alt text as caption under the image
|
||||
var images = document.querySelectorAll("main img[alt]:not([alt=''])");
|
||||
images.forEach(function (img) {
|
||||
var caption = document.createElement("span");
|
||||
caption.classList.add("caption");
|
||||
caption.textContent = img.getAttribute("alt");
|
||||
img.insertAdjacentElement("afterend", caption);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,349 +0,0 @@
|
|||
---
|
||||
---
|
||||
|
||||
:root {
|
||||
--border-color: #d8d8d8;
|
||||
--background: #efefef;
|
||||
--foreground: #000;
|
||||
--link-color: #0A4F94;
|
||||
--code-c1: green;
|
||||
--code-k: blue;
|
||||
--code-s: #A31515;
|
||||
--code-n: #22728a;
|
||||
--code-nf: #74531F;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark)
|
||||
{
|
||||
:root {
|
||||
--background: #121212;
|
||||
--foreground: #ddd;
|
||||
--link-color: #5AADFF;
|
||||
--code-c1: #57A64A;
|
||||
--code-k: #569CD6;
|
||||
--code-s: #D69D85;
|
||||
--code-n: #4EC9B0;
|
||||
--code-nf: #DCDCAA;
|
||||
}
|
||||
|
||||
article img {
|
||||
opacity: .85;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
min-height: 100vh;
|
||||
padding: 0 10px;
|
||||
display: flex;
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
flex-direction: column;
|
||||
text-size-adjust: none;
|
||||
-webkit-text-size-adjust: none;
|
||||
font: 16px/1.6 "Open Sans",Ubuntu,"Nimbus Sans L",Avenir,AvenirNext,"Segoe UI",Helvetica,Arial,sans-serif;
|
||||
counter-reset: figure;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
}
|
||||
|
||||
article > p {
|
||||
padding-bottom: 1.5em;
|
||||
}
|
||||
|
||||
img,
|
||||
video {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.caption {
|
||||
display: block;
|
||||
font-style: italic;
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
.caption::before {
|
||||
counter-increment: figure;
|
||||
content: "Figure " counter(figure) ": ";
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding: .6em 1em .6em 3em;
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 1em;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
blockquote::before {
|
||||
content: "”";
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 7em;
|
||||
opacity: .5;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -.4em;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: rgba(180, 180, 180, .1);
|
||||
color: var(--foreground);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 3px;
|
||||
overflow: auto;
|
||||
padding: .5em .7em;
|
||||
margin: -1em 0 2em 0;
|
||||
font-size: .9em;
|
||||
width: 100%;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
}
|
||||
|
||||
code .c1 {
|
||||
color: var(--code-c1);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
code .s {
|
||||
color: var(--code-s);
|
||||
}
|
||||
|
||||
code .n,
|
||||
code .na,
|
||||
code .nc {
|
||||
color: var(--code-n);
|
||||
}
|
||||
|
||||
code .k,
|
||||
code .kt {
|
||||
color: var(--code-k);
|
||||
}
|
||||
|
||||
code .nf,
|
||||
code .nt {
|
||||
color: var(--code-nf);
|
||||
}
|
||||
|
||||
p > code {
|
||||
background: rgba(180, 180, 180, .1);
|
||||
border-radius: 6px;
|
||||
font-size: 85%;
|
||||
padding: .1em .3em;
|
||||
border: 1px solid rgba(180, 180, 180, .3);
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
padding: .2em 0 0 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
font-variant: small-caps;
|
||||
letter-spacing: 1px;
|
||||
font-size: 1.2em;
|
||||
text-decoration: none;
|
||||
background-size: 20px;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 1em 0 0 0;
|
||||
display: flex;;
|
||||
flex: 1;
|
||||
border-top: 1px solid var(--border-color);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid grey;
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
#menu {
|
||||
font-size: .80em;
|
||||
min-width: fit-content;
|
||||
border-right: 1px solid var(--border-color);
|
||||
padding: 1em 1.5em 1em .7em;
|
||||
margin-right: 2em;
|
||||
}
|
||||
|
||||
#menu label,
|
||||
#menu input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#menu a {
|
||||
color: var(--foreground);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#menu a:hover,
|
||||
#menu a:focus,
|
||||
#menu a:active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#menu > a {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#menu a[aria-current] {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#menu ul {
|
||||
list-style: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#menu a[aria-haspopup]::before {
|
||||
content: "›";
|
||||
position:absolute;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
#menu .open a[aria-haspopup]::before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
#menu li:not(.open) ul {
|
||||
visibility: collapse;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
#menu > ul > li {
|
||||
margin-bottom: .3em;
|
||||
}
|
||||
|
||||
#menu ul ul li {
|
||||
padding: .3em 0 0 1em;
|
||||
}
|
||||
|
||||
article {
|
||||
//margin: 0 1em 0 1.5em;
|
||||
padding: 1em 0 2em 0;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
min-width: 0; // needed for <pre> not to be too wide
|
||||
}
|
||||
|
||||
article h2 a,
|
||||
article h3 a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
article h2 a:hover:after,
|
||||
article h3 a:hover:after {
|
||||
content: " 🔗";
|
||||
font-size: .7em;
|
||||
}
|
||||
|
||||
article .meta {
|
||||
font-size: .8em;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
bottom: 1em;
|
||||
right: 0
|
||||
}
|
||||
|
||||
article ol,
|
||||
article ul {
|
||||
padding-left: 2.5em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
article li::marker {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
footer {
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
footer strong {
|
||||
color: crimson;
|
||||
}
|
||||
|
||||
footer li {
|
||||
display: inline-block;
|
||||
margin-bottom: .3em;
|
||||
}
|
||||
|
||||
footer li:not(:last-child):after{
|
||||
content: ' - '
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1023px) {
|
||||
body {
|
||||
margin-left: unquote("max(env(safe-area-inset-left), 10px)");
|
||||
}
|
||||
#menu {
|
||||
padding: 1em 0 0 0;
|
||||
border: none;
|
||||
margin: 0;
|
||||
}
|
||||
#menu label {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
color: darkgray;
|
||||
position: absolute;
|
||||
top: .4em;
|
||||
right: .8em;
|
||||
font-size: 1.5em;
|
||||
background-color: var(--background);
|
||||
}
|
||||
#hamburger {
|
||||
display: none;
|
||||
}
|
||||
#menu > ul {
|
||||
display: none;
|
||||
background: var(--background);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: 10px;
|
||||
z-index: 1;
|
||||
margin-left: unquote("max(env(safe-area-inset-left), 10px)");
|
||||
}
|
||||
#menu input:checked + ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
main > section {
|
||||
margin: 0
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
#menu {
|
||||
display: none;
|
||||
}
|
||||
main > section {
|
||||
margin: 0
|
||||
}
|
||||
footer ul {
|
||||
display: none
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,868 +0,0 @@
|
|||
<a name='assembly'></a>
|
||||
# Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
## Contents
|
||||
|
||||
- [EditBatch](#T-Microsoft-VisualStudio-Extensibility-Editor-EditBatch 'Microsoft.VisualStudio.Extensibility.Editor.EditBatch')
|
||||
- [EditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-EditResponse 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse')
|
||||
- [#ctor(succeeded,message,documentEditResults,textViewEditResults)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-#ctor-System-Boolean,System-String,System-Collections-Generic-IReadOnlyDictionary{Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse},System-Collections-Generic-IReadOnlyDictionary{Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse}- 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse.#ctor(System.Boolean,System.String,System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse},System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse})')
|
||||
- [DocumentEditResults](#P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-DocumentEditResults 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse.DocumentEditResults')
|
||||
- [Message](#P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-Message 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse.Message')
|
||||
- [Succeeded](#P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-Succeeded 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse.Succeeded')
|
||||
- [TextViewEditResults](#P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-TextViewEditResults 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse.TextViewEditResults')
|
||||
- [EditorExtensibility](#T-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility')
|
||||
- [#ctor(extensibility,editorHostService)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-#ctor-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility,Microsoft-VisualStudio-Extensibility-Editor-IEditorHostService- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.#ctor(Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility,Microsoft.VisualStudio.Extensibility.Editor.IEditorHostService)')
|
||||
- [EditAsync(editorSource,cancellationToken)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-EditAsync-System-Action{Microsoft-VisualStudio-Extensibility-Editor-IEditBatch},System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.EditAsync(System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch},System.Threading.CancellationToken)')
|
||||
- [GetActiveTextViewAsync(clientContext,cancellationToken)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-GetActiveTextViewAsync-Microsoft-VisualStudio-Extensibility-IClientContext,System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.GetActiveTextViewAsync(Microsoft.VisualStudio.Extensibility.IClientContext,System.Threading.CancellationToken)')
|
||||
- [SubscribeToOptionChangesAsync\`\`1(document,textDocumentOption,cancellationToken,changeHandler)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-SubscribeToOptionChangesAsync``1-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextDocumentOption{``0},System-Threading-CancellationToken,System-Func{``0,System-Threading-Tasks-Task}- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.SubscribeToOptionChangesAsync``1(Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption{``0},System.Threading.CancellationToken,System.Func{``0,System.Threading.Tasks.Task})')
|
||||
- [SubscribeToOptionChangesAsync\`\`1(textView,textViewOption,cancellationToken,changeHandler)](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-SubscribeToOptionChangesAsync``1-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextViewOption{``0},System-Threading-CancellationToken,System-Func{``0,System-Threading-Tasks-Task}- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.SubscribeToOptionChangesAsync``1(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextViewOption{``0},System.Threading.CancellationToken,System.Func{``0,System.Threading.Tasks.Task})')
|
||||
- [EditorOptionObserver\`1](#T-Microsoft-VisualStudio-Extensibility-Editor-EditorOptionObserver`1 'Microsoft.VisualStudio.Extensibility.Editor.EditorOptionObserver`1')
|
||||
- [ExtensionMethods](#T-Microsoft-VisualStudio-Extensibility-ExtensionMethods 'Microsoft.VisualStudio.Extensibility.ExtensionMethods')
|
||||
- [IsExceptionType\`\`1(e)](#M-Microsoft-VisualStudio-Extensibility-ExtensionMethods-IsExceptionType``1-StreamJsonRpc-RemoteInvocationException- 'Microsoft.VisualStudio.Extensibility.ExtensionMethods.IsExceptionType``1(StreamJsonRpc.RemoteInvocationException)')
|
||||
- [ITextViewChangedListener](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewChangedListener 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewChangedListener')
|
||||
- [TextViewChangedAsync()](#M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewChangedListener-TextViewChangedAsync-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs,System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewChangedListener.TextViewChangedAsync(Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs,System.Threading.CancellationToken)')
|
||||
- [ITextViewChangedListenerContract](#T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewChangedListenerContract 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewChangedListenerContract')
|
||||
- [TextViewChangedAsync()](#M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewChangedListenerContract-TextViewChangedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange,System-Threading-CancellationToken- 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewChangedListenerContract.TextViewChangedAsync(Microsoft.VisualStudio.RpcContracts.Editor.TextViewChange,System.Threading.CancellationToken)')
|
||||
- [ITextViewExtension](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewExtension 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewExtension')
|
||||
- [TextViewExtensionConfiguration](#P-Microsoft-VisualStudio-Extensibility-Editor-ITextViewExtension-TextViewExtensionConfiguration 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewExtension.TextViewExtensionConfiguration')
|
||||
- [ITextViewMarginProvider](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewMarginProvider')
|
||||
- [TextViewMarginProviderConfiguration](#P-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider-TextViewMarginProviderConfiguration 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewMarginProvider.TextViewMarginProviderConfiguration')
|
||||
- [CreateVisualElementAsync(textView,cancellationToken)](#M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider-CreateVisualElementAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewMarginProvider.CreateVisualElementAsync(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,System.Threading.CancellationToken)')
|
||||
- [ITextViewMarginProviderContract](#T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewMarginProviderContract 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewMarginProviderContract')
|
||||
- [CreateVisualElementAsync()](#M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewMarginProviderContract-CreateVisualElementAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken- 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewMarginProviderContract.CreateVisualElementAsync(Microsoft.VisualStudio.RpcContracts.Editor.TextViewContract,System.Threading.CancellationToken)')
|
||||
- [ITextViewOpenClosedListener](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewOpenClosedListener')
|
||||
- [TextViewClosedAsync()](#M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener-TextViewClosedAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewOpenClosedListener.TextViewClosedAsync(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,System.Threading.CancellationToken)')
|
||||
- [TextViewOpenedAsync()](#M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener-TextViewOpenedAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewOpenClosedListener.TextViewOpenedAsync(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,System.Threading.CancellationToken)')
|
||||
- [ITextViewOpenClosedListenerContract](#T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewOpenClosedListenerContract')
|
||||
- [TextViewClosedAsync()](#M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract-TextViewClosedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken- 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewOpenClosedListenerContract.TextViewClosedAsync(Microsoft.VisualStudio.RpcContracts.Editor.TextViewContract,System.Threading.CancellationToken)')
|
||||
- [TextViewOpenedAsync()](#M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract-TextViewOpenedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken- 'Microsoft.VisualStudio.RpcContracts.Editor.ITextViewOpenClosedListenerContract.TextViewOpenedAsync(Microsoft.VisualStudio.RpcContracts.Editor.TextViewContract,System.Threading.CancellationToken)')
|
||||
- [KnownDocumentOptions](#T-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions 'Microsoft.VisualStudio.Extensibility.Editor.KnownDocumentOptions')
|
||||
- [ConvertTabsToSpacesOption](#F-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions-ConvertTabsToSpacesOption 'Microsoft.VisualStudio.Extensibility.Editor.KnownDocumentOptions.ConvertTabsToSpacesOption')
|
||||
- [TabSizeOption](#F-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions-TabSizeOption 'Microsoft.VisualStudio.Extensibility.Editor.KnownDocumentOptions.TabSizeOption')
|
||||
- [KnownViewOptions](#T-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions 'Microsoft.VisualStudio.Extensibility.Editor.KnownViewOptions')
|
||||
- [LineSpacingOption](#F-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions-LineSpacingOption 'Microsoft.VisualStudio.Extensibility.Editor.KnownViewOptions.LineSpacingOption')
|
||||
- [ProhibitUserInputOption](#F-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions-ProhibitUserInputOption 'Microsoft.VisualStudio.Extensibility.Editor.KnownViewOptions.ProhibitUserInputOption')
|
||||
- [TextDocumentSnapshotEditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse')
|
||||
- [#ctor(after,editResult)](#M-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-RpcContracts-Editor-EditResult- 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse.#ctor(Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot,Microsoft.VisualStudio.RpcContracts.Editor.EditResult)')
|
||||
- [After](#P-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-After 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse.After')
|
||||
- [EditResult](#P-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-EditResult 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse.EditResult')
|
||||
- [TextEdit](#T-Microsoft-VisualStudio-Extensibility-Editor-TextEdit 'Microsoft.VisualStudio.Extensibility.Editor.TextEdit')
|
||||
- [Range](#P-Microsoft-VisualStudio-Extensibility-Editor-TextEdit-Range 'Microsoft.VisualStudio.Extensibility.Editor.TextEdit.Range')
|
||||
- [Text](#P-Microsoft-VisualStudio-Extensibility-Editor-TextEdit-Text 'Microsoft.VisualStudio.Extensibility.Editor.TextEdit.Text')
|
||||
- [TextViewChange](#T-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange 'Microsoft.VisualStudio.RpcContracts.Editor.TextViewChange')
|
||||
- [AfterTextView](#P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-AfterTextView 'Microsoft.VisualStudio.RpcContracts.Editor.TextViewChange.AfterTextView')
|
||||
- [BeforeTextView](#P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-BeforeTextView 'Microsoft.VisualStudio.RpcContracts.Editor.TextViewChange.BeforeTextView')
|
||||
- [DocumentEdits](#P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-DocumentEdits 'Microsoft.VisualStudio.RpcContracts.Editor.TextViewChange.DocumentEdits')
|
||||
- [TextViewChangedArgs](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs')
|
||||
- [#ctor(beforeTextView,afterTextView,edits)](#M-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Collections-Generic-IReadOnlyList{Microsoft-VisualStudio-Extensibility-Editor-TextEdit}- 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs.#ctor(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,System.Collections.Generic.IReadOnlyList{Microsoft.VisualStudio.Extensibility.Editor.TextEdit})')
|
||||
- [AfterTextView](#P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-AfterTextView 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs.AfterTextView')
|
||||
- [BeforeTextView](#P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-BeforeTextView 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs.BeforeTextView')
|
||||
- [Edits](#P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-Edits 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs.Edits')
|
||||
- [TextViewChangedListener](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedListener 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedListener')
|
||||
- [TextViewEditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse 'Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse')
|
||||
- [#ctor(after,editResult)](#M-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-RpcContracts-Editor-EditResult- 'Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse.#ctor(Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.RpcContracts.Editor.EditResult)')
|
||||
- [After](#P-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-After 'Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse.After')
|
||||
- [EditResult](#P-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-EditResult 'Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse.EditResult')
|
||||
- [TextViewMarginProvider](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewMarginProvider 'Microsoft.VisualStudio.Extensibility.Editor.TextViewMarginProvider')
|
||||
- [TextViewOpenClosedListener](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewOpenClosedListener 'Microsoft.VisualStudio.Extensibility.Editor.TextViewOpenClosedListener')
|
||||
- [VisualStudioExtensibilityExtensions](#T-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibilityExtensions 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibilityExtensions')
|
||||
- [Editor(extensibility)](#M-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibilityExtensions-Editor-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility- 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibilityExtensions.Editor(Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility)')
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-EditBatch'></a>
|
||||
## EditBatch `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Builder for [CompoundEditContract](#T-Microsoft-VisualStudio-RpcContracts-Editor-CompoundEditContract 'Microsoft.VisualStudio.RpcContracts.Editor.CompoundEditContract'), describing a set of
|
||||
state changes that should be made by the process owning the entities to
|
||||
be changed, on behalf of the extension.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-EditResponse'></a>
|
||||
## EditResponse `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Describes the cumulative result of a call to
|
||||
[EditAsync](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-EditAsync-System-Action{Microsoft-VisualStudio-Extensibility-Editor-IEditBatch},System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.EditAsync(System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch},System.Threading.CancellationToken)').
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-#ctor-System-Boolean,System-String,System-Collections-Generic-IReadOnlyDictionary{Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse},System-Collections-Generic-IReadOnlyDictionary{Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse}-'></a>
|
||||
### #ctor(succeeded,message,documentEditResults,textViewEditResults) `constructor`
|
||||
|
||||
##### Summary
|
||||
|
||||
Initializes a new instance of [EditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-EditResponse 'Microsoft.VisualStudio.Extensibility.Editor.EditResponse').
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| succeeded | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | `true` if the cumulative operation completed successfully. |
|
||||
| message | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | Any cumulative error message, `null`, or [Empty](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String.Empty 'System.String.Empty') if none. |
|
||||
| documentEditResults | [System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.IReadOnlyDictionary 'System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse}') | |
|
||||
| textViewEditResults | [System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.IReadOnlyDictionary 'System.Collections.Generic.IReadOnlyDictionary{Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot,Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse}') | Per-document operation results including per document errors and updated [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot')
|
||||
versions. |
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-DocumentEditResults'></a>
|
||||
### DocumentEditResults `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Per-document operation results including per document errors and updated [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot')
|
||||
versions.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Key of dictionary is the version of the document prior to the edits.
|
||||
[After](#P-Microsoft-VisualStudio-RpcContracts-Editor-TextDocumentEditResponseContract-After 'Microsoft.VisualStudio.RpcContracts.Editor.TextDocumentEditResponseContract.After') contains the updated document version.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-Message'></a>
|
||||
### Message `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Any cumulative error message, `null`, or [Empty](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String.Empty 'System.String.Empty') if none.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-Succeeded'></a>
|
||||
### Succeeded `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
`true` if the cumulative operation completed successfully.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-EditResponse-TextViewEditResults'></a>
|
||||
### TextViewEditResults `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Per text view operation results including per text view errors and updated [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot')
|
||||
versions.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility'></a>
|
||||
## EditorExtensibility `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Framework object exposing methods for getting and interacting with [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot')s
|
||||
and [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot')s and performing document edits and other state changes.
|
||||
|
||||
##### Remarks
|
||||
|
||||
You can get an instance of [EditorExtensibility](#T-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility') by calling
|
||||
[Editor](#M-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibilityExtensions-Editor-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility- 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibilityExtensions.Editor(Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility)') within an
|
||||
[ExtensionPart](#T-Microsoft-VisualStudio-Extensibility-ExtensionPart 'Microsoft.VisualStudio.Extensibility.ExtensionPart') or Command.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-#ctor-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility,Microsoft-VisualStudio-Extensibility-Editor-IEditorHostService-'></a>
|
||||
### #ctor(extensibility,editorHostService) `constructor`
|
||||
|
||||
##### Summary
|
||||
|
||||
Initializes a new instance of [EditorExtensibility](#T-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility').
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| extensibility | [Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility](#T-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility') | The root extensibility object. |
|
||||
| editorHostService | [Microsoft.VisualStudio.Extensibility.Editor.IEditorHostService](#T-Microsoft-VisualStudio-Extensibility-Editor-IEditorHostService 'Microsoft.VisualStudio.Extensibility.Editor.IEditorHostService') | The editor host service. |
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-EditAsync-System-Action{Microsoft-VisualStudio-Extensibility-Editor-IEditBatch},System-Threading-CancellationToken-'></a>
|
||||
### EditAsync(editorSource,cancellationToken) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Initiates an edit request in the host Visual Studio process, enabling
|
||||
the extension to atomically request one or more [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot')
|
||||
edits, caret position changes, or other state changes.
|
||||
|
||||
##### Returns
|
||||
|
||||
A response object detailing whether the operation was successful and which [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot')s and [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot')s changed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| editorSource | [System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Action 'System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch}') | A service for obtaining editors for requesting changes to a [IEditable\`1](#T-Microsoft-VisualStudio-Extensibility-Editor-IEditable`1 'Microsoft.VisualStudio.Extensibility.Editor.IEditable`1') object, such as [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot'). |
|
||||
| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | Cancels a pending request. |
|
||||
|
||||
##### Remarks
|
||||
|
||||
Edit request is sent to Visual Studio IDE, where it succeeds only if the object being edited hasn't
|
||||
changed since the version the request was made one. If the document has changed, the change may be rejected,
|
||||
requiring the extension to retry on a newer version.
|
||||
|
||||
Edits are applied atomically. The best practice is to do all changes that should occur within a narrow time
|
||||
frame within a single EditAsync() call to reduce the likelihood of unexpected behavior arising from user edits,
|
||||
or language service actions that occur between edits.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-GetActiveTextViewAsync-Microsoft-VisualStudio-Extensibility-IClientContext,System-Threading-CancellationToken-'></a>
|
||||
### GetActiveTextViewAsync(clientContext,cancellationToken) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the currently focused [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') in the host Visual Studio process.
|
||||
|
||||
##### Returns
|
||||
|
||||
An instance of [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') or `null`.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| clientContext | [Microsoft.VisualStudio.Extensibility.IClientContext](#T-Microsoft-VisualStudio-Extensibility-IClientContext 'Microsoft.VisualStudio.Extensibility.IClientContext') | The client context, usually passed to command handlers. |
|
||||
| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | Cancels the request. |
|
||||
|
||||
##### Remarks
|
||||
|
||||
Can return `null` if the `clientContext` references a version of text view
|
||||
that is sufficiently old so as to no longer be cached.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-SubscribeToOptionChangesAsync``1-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextDocumentOption{``0},System-Threading-CancellationToken,System-Func{``0,System-Threading-Tasks-Task}-'></a>
|
||||
### SubscribeToOptionChangesAsync\`\`1(document,textDocumentOption,cancellationToken,changeHandler) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Registers to listen for option changes in the scope of a text document.
|
||||
|
||||
##### Returns
|
||||
|
||||
an [IDisposable](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.IDisposable 'System.IDisposable') to manage the lifetime of the subscription.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| document | [Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot') | Document snapshot to use as the scope. |
|
||||
| textDocumentOption | [Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption{\`\`0}](#T-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentOption{``0} 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption{``0}') | Option identifier. |
|
||||
| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | Cancellation token to monitor while subscribing. |
|
||||
| changeHandler | [System.Func{\`\`0,System.Threading.Tasks.Task}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Func 'System.Func{``0,System.Threading.Tasks.Task}') | Change handler to invoke, this handler will always be called once with the initial value. |
|
||||
|
||||
##### Generic Types
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| T | Type of the option value. |
|
||||
|
||||
##### Exceptions
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| [System.ArgumentOutOfRangeException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentOutOfRangeException 'System.ArgumentOutOfRangeException') | Thrown when option is not defined in this scope. |
|
||||
|
||||
##### Remarks
|
||||
|
||||
The change handler will be called in series awaiting previous calls.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-SubscribeToOptionChangesAsync``1-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-TextViewOption{``0},System-Threading-CancellationToken,System-Func{``0,System-Threading-Tasks-Task}-'></a>
|
||||
### SubscribeToOptionChangesAsync\`\`1(textView,textViewOption,cancellationToken,changeHandler) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Registers to listen for option changes in the scope of a text view.
|
||||
|
||||
##### Returns
|
||||
|
||||
an [IDisposable](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.IDisposable 'System.IDisposable') to manage the lifetime of the subscription.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| textView | [Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') | Text view snapshot to use as the scope. |
|
||||
| textViewOption | [Microsoft.VisualStudio.Extensibility.Editor.TextViewOption{\`\`0}](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewOption{``0} 'Microsoft.VisualStudio.Extensibility.Editor.TextViewOption{``0}') | Option identifier. |
|
||||
| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | Cancellation token to monitor while subscribing. |
|
||||
| changeHandler | [System.Func{\`\`0,System.Threading.Tasks.Task}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Func 'System.Func{``0,System.Threading.Tasks.Task}') | Change handler to invoke, this handler will always be called once with the initial value. |
|
||||
|
||||
##### Generic Types
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| T | Type of the option value. |
|
||||
|
||||
##### Exceptions
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| [System.ArgumentOutOfRangeException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentOutOfRangeException 'System.ArgumentOutOfRangeException') | Thrown when option is not defined in this scope. |
|
||||
|
||||
##### Remarks
|
||||
|
||||
The change handler will be called in series awaiting previous calls.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-EditorOptionObserver`1'></a>
|
||||
## EditorOptionObserver\`1 `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
An observer for listening to changes in editor options.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-ExtensionMethods'></a>
|
||||
## ExtensionMethods `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-ExtensionMethods-IsExceptionType``1-StreamJsonRpc-RemoteInvocationException-'></a>
|
||||
### IsExceptionType\`\`1(e) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Checks if a remote exception contains an error data of the specified type.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| e | [StreamJsonRpc.RemoteInvocationException](#T-StreamJsonRpc-RemoteInvocationException 'StreamJsonRpc.RemoteInvocationException') | Remote exception instance. |
|
||||
|
||||
##### Generic Types
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| T | Exception type to check for. |
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewChangedListener'></a>
|
||||
## ITextViewChangedListener `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Extensibility point for listening for [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot')s to be changed.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewChangedListener-TextViewChangedAsync-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs,System-Threading-CancellationToken-'></a>
|
||||
### TextViewChangedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is changed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewChangedListenerContract'></a>
|
||||
## ITextViewChangedListenerContract `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.RpcContracts.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
RPC contract for a listener that is notified when text views are changed.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewChangedListenerContract-TextViewChangedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange,System-Threading-CancellationToken-'></a>
|
||||
### TextViewChangedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is changed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewExtension'></a>
|
||||
## ITextViewExtension `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Base interface for extensibility points of text views.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-ITextViewExtension-TextViewExtensionConfiguration'></a>
|
||||
### TextViewExtensionConfiguration `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the configuration for this [ITextViewExtension](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewExtension 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewExtension'). The value of this property is evaluated at
|
||||
compile time when building the Visual Studio extension.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider'></a>
|
||||
## ITextViewMarginProvider `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Extensibility point for providing text view margins.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Typical usage (providing a margin and listening to text view and text document changes):
|
||||
|
||||
```
|
||||
[Export]
|
||||
internal class MyTextViewMarginProvider : ExtensionPart, ITextViewMarginProvider, ITextViewChangedListener
|
||||
```
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider-TextViewMarginProviderConfiguration'></a>
|
||||
### TextViewMarginProviderConfiguration `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the configuration for this [ITextViewMarginProvider](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewMarginProvider'). The value of this property is evaluated at
|
||||
compile time when building the Visual Studio extension.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewMarginProvider-CreateVisualElementAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken-'></a>
|
||||
### CreateVisualElementAsync(textView,cancellationToken) `method`
|
||||
|
||||
##### Returns
|
||||
|
||||
An [IRemoteUserControl](#T-Microsoft-VisualStudio-RpcContracts-RemoteUI-IRemoteUserControl 'Microsoft.VisualStudio.RpcContracts.RemoteUI.IRemoteUserControl') which represents the margin's UI content.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| textView | [Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') | |
|
||||
| cancellationToken | [System.Threading.CancellationToken](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Threading.CancellationToken 'System.Threading.CancellationToken') | A cancellation token to cancel the in-progress content creation. |
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewMarginProviderContract'></a>
|
||||
## ITextViewMarginProviderContract `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.RpcContracts.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
RPC contract for a text view margin provider.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewMarginProviderContract-CreateVisualElementAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken-'></a>
|
||||
### CreateVisualElementAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document is opened.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Special scenarios:
|
||||
- Document type changes from an unmatching document type to a matching, such as when the user changes the file extension,
|
||||
are considered 'text view creations' for the purposes of this API.
|
||||
- This API will be called for all already open text views when an extension is hot loaded in the middle of an
|
||||
existing session.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener'></a>
|
||||
## ITextViewOpenClosedListener `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Extensibility point for listening for [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot')s to be opened
|
||||
and closed.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener-TextViewClosedAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken-'></a>
|
||||
### TextViewClosedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is closed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Special scenarios:
|
||||
- Document type changes from a matching document type to an unmatching, such as when the user changes the file extension,
|
||||
are considered 'text view closes' for the purposes of this API.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-ITextViewOpenClosedListener-TextViewOpenedAsync-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Threading-CancellationToken-'></a>
|
||||
### TextViewOpenedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is opened.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Special scenarios:
|
||||
- Document type changes from an unmatching document type to a matching, such as when the user changes the file extension,
|
||||
are considered 'text view creations' for the purposes of this API.
|
||||
- This API will be called for all already open text views when an extension is hot loaded in the middle of an
|
||||
existing session.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract'></a>
|
||||
## ITextViewOpenClosedListenerContract `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.RpcContracts.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
RPC contract for a listener that is notified when text views are
|
||||
opened and closed.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract-TextViewClosedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken-'></a>
|
||||
### TextViewClosedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is closed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Special scenarios:
|
||||
- Document type changes from a matching document type to an unmatching, such as when the user changes the file extension,
|
||||
are considered 'text view closes' for the purposes of this API.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-RpcContracts-Editor-ITextViewOpenClosedListenerContract-TextViewOpenedAsync-Microsoft-VisualStudio-RpcContracts-Editor-TextViewContract,System-Threading-CancellationToken-'></a>
|
||||
### TextViewOpenedAsync() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Called when an [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') with matching document type is opened.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
##### Remarks
|
||||
|
||||
Special scenarios:
|
||||
- Document type changes from an unmatching document type to a matching, such as when the user changes the file extension,
|
||||
are considered 'text view creations' for the purposes of this API.
|
||||
- This API will be called for all already open text views when an extension is hot loaded in the middle of an
|
||||
existing session.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions'></a>
|
||||
## KnownDocumentOptions `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Enumerates known text document options.
|
||||
|
||||
<a name='F-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions-ConvertTabsToSpacesOption'></a>
|
||||
### ConvertTabsToSpacesOption `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the option to determine if tabs should be converted to spaces.
|
||||
|
||||
<a name='F-Microsoft-VisualStudio-Extensibility-Editor-KnownDocumentOptions-TabSizeOption'></a>
|
||||
### TabSizeOption `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the option for the default tab size in a text document.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions'></a>
|
||||
## KnownViewOptions `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Enumerates known text document options.
|
||||
|
||||
<a name='F-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions-LineSpacingOption'></a>
|
||||
### LineSpacingOption `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the option for vertical space between lines in the view.
|
||||
|
||||
<a name='F-Microsoft-VisualStudio-Extensibility-Editor-KnownViewOptions-ProhibitUserInputOption'></a>
|
||||
### ProhibitUserInputOption `constants`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the option to determine if view allows user input.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse'></a>
|
||||
## TextDocumentSnapshotEditResponse `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Describes the outcome of a call to [EditAsync](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-EditAsync-System-Action{Microsoft-VisualStudio-Extensibility-Editor-IEditBatch},System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.EditAsync(System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch},System.Threading.CancellationToken)')
|
||||
for changes to a particular [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot') in the host Visual Studio process.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot,Microsoft-VisualStudio-RpcContracts-Editor-EditResult-'></a>
|
||||
### #ctor(after,editResult) `constructor`
|
||||
|
||||
##### Summary
|
||||
|
||||
Initializes a new instance of [TextDocumentSnapshotEditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse 'Microsoft.VisualStudio.Extensibility.Editor.TextDocumentSnapshotEditResponse').
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| after | [Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot') | The [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot') version after the changes were applied. |
|
||||
| editResult | [Microsoft.VisualStudio.RpcContracts.Editor.EditResult](#T-Microsoft-VisualStudio-RpcContracts-Editor-EditResult 'Microsoft.VisualStudio.RpcContracts.Editor.EditResult') | The result of the edit operation. |
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-After'></a>
|
||||
### After `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot') version after the changes were applied.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextDocumentSnapshotEditResponse-EditResult'></a>
|
||||
### EditResult `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The result of the edit operation. [Success](#F-Microsoft-VisualStudio-RpcContracts-Editor-EditResult-Success 'Microsoft.VisualStudio.RpcContracts.Editor.EditResult.Success') if
|
||||
all changes were applied successfully to the target [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot').
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextEdit'></a>
|
||||
## TextEdit `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
A list of changes applied to a [ITextDocumentSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextDocumentSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot').
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextEdit-Range'></a>
|
||||
### Range `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The range to replace. Can be zero length.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextEdit-Text'></a>
|
||||
### Text `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The new text to insert.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange'></a>
|
||||
## TextViewChange `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.RpcContracts.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
RPC contract representing a [TextViewChangedArgs](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs').
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-AfterTextView'></a>
|
||||
### AfterTextView `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') after the change.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-BeforeTextView'></a>
|
||||
### BeforeTextView `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') before the change.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-RpcContracts-Editor-TextViewChange-DocumentEdits'></a>
|
||||
### DocumentEdits `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The set of edits made to the document during this change.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs'></a>
|
||||
## TextViewChangedArgs `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Arguments for [ITextViewChangedListener](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewChangedListener 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewChangedListener').
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,System-Collections-Generic-IReadOnlyList{Microsoft-VisualStudio-Extensibility-Editor-TextEdit}-'></a>
|
||||
### #ctor(beforeTextView,afterTextView,edits) `constructor`
|
||||
|
||||
##### Summary
|
||||
|
||||
Creates a new instance of [TextViewChangedArgs](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs 'Microsoft.VisualStudio.Extensibility.Editor.TextViewChangedArgs').
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| beforeTextView | [Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') | The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') before the change. |
|
||||
| afterTextView | [Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') | The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') after. |
|
||||
| edits | [System.Collections.Generic.IReadOnlyList{Microsoft.VisualStudio.Extensibility.Editor.TextEdit}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.IReadOnlyList 'System.Collections.Generic.IReadOnlyList{Microsoft.VisualStudio.Extensibility.Editor.TextEdit}') | A list of changes applied to the text document. |
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-AfterTextView'></a>
|
||||
### AfterTextView `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') after the change.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-BeforeTextView'></a>
|
||||
### BeforeTextView `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The state of the [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') before the change.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedArgs-Edits'></a>
|
||||
### Edits `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
A list of changes applied to the text document.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextViewChangedListener'></a>
|
||||
## TextViewChangedListener `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Wrapper object that converts RPC types to C# types.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse'></a>
|
||||
## TextViewEditResponse `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Describes the outcome of a call to [EditAsync](#M-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility-EditAsync-System-Action{Microsoft-VisualStudio-Extensibility-Editor-IEditBatch},System-Threading-CancellationToken- 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility.EditAsync(System.Action{Microsoft.VisualStudio.Extensibility.Editor.IEditBatch},System.Threading.CancellationToken)')
|
||||
for changes to a particular [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') in the host Visual Studio process.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-#ctor-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot,Microsoft-VisualStudio-RpcContracts-Editor-EditResult-'></a>
|
||||
### #ctor(after,editResult) `constructor`
|
||||
|
||||
##### Summary
|
||||
|
||||
Initializes a new instance of [TextViewEditResponse](#T-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse 'Microsoft.VisualStudio.Extensibility.Editor.TextViewEditResponse').
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| after | [Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') | The [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') version after the changes were applied. |
|
||||
| editResult | [Microsoft.VisualStudio.RpcContracts.Editor.EditResult](#T-Microsoft-VisualStudio-RpcContracts-Editor-EditResult 'Microsoft.VisualStudio.RpcContracts.Editor.EditResult') | The result of the edit operation. |
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-After'></a>
|
||||
### After `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot') version after the changes were applied.
|
||||
|
||||
<a name='P-Microsoft-VisualStudio-Extensibility-Editor-TextViewEditResponse-EditResult'></a>
|
||||
### EditResult `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
The result of the edit operation. [Success](#F-Microsoft-VisualStudio-RpcContracts-Editor-EditResult-Success 'Microsoft.VisualStudio.RpcContracts.Editor.EditResult.Success') if
|
||||
all changes were applied successfully to the target [ITextViewSnapshot](#T-Microsoft-VisualStudio-Extensibility-Editor-ITextViewSnapshot 'Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot').
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextViewMarginProvider'></a>
|
||||
## TextViewMarginProvider `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Wrapper object that converts RPC types to C# types.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-Editor-TextViewOpenClosedListener'></a>
|
||||
## TextViewOpenClosedListener `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility.Editor
|
||||
|
||||
##### Summary
|
||||
|
||||
Wrapper object that converts RPC types to C# types.
|
||||
|
||||
<a name='T-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibilityExtensions'></a>
|
||||
## VisualStudioExtensibilityExtensions `type`
|
||||
|
||||
##### Namespace
|
||||
|
||||
Microsoft.VisualStudio.Extensibility
|
||||
|
||||
##### Summary
|
||||
|
||||
Editor provided extension methods for acquiring VS extensibility points.
|
||||
|
||||
<a name='M-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibilityExtensions-Editor-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility-'></a>
|
||||
### Editor(extensibility) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets an instance of the [EditorExtensibility](#T-Microsoft-VisualStudio-Extensibility-Editor-EditorExtensibility 'Microsoft.VisualStudio.Extensibility.Editor.EditorExtensibility') point.
|
||||
|
||||
##### Returns
|
||||
|
||||
Editor extensibility.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| extensibility | [Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility](#T-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility') | The root [VisualStudioExtensibility](#T-Microsoft-VisualStudio-Extensibility-VisualStudioExtensibility 'Microsoft.VisualStudio.Extensibility.VisualStudioExtensibility') instance. |
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,115 +0,0 @@
|
|||
# How to upgrade NuGet dependencies in Microsoft OSS repos?
|
||||
|
||||
Many Microsoft OSS repos have nuget.config files that point to public feeds in one or more Azure DevOps accounts.
|
||||
Depending on how a given repo and its feed sources are configured, an OSS contributor that is adding or updating a NuGet dependency may get a 401 error during the add/update/restore process.
|
||||
This document outlines how that OSS contributor can workaround the issue and contribute a PR successfully.
|
||||
|
||||
To be clear, it is important to us that our OSS repos be buildable by external users.
|
||||
Running nuget restore on any of our OSS repos without any changes made locally should Just Work.
|
||||
|
||||
Certain changes you may make to the nuget dependencies is where you can hit 401 errors, and the intent of this document is to get you unblocked.
|
||||
|
||||
## The symptom
|
||||
|
||||
First let's review what leads up to the problem.
|
||||
|
||||
These are the changes that you might make in one of our repos that we anticipate may present the issue:
|
||||
|
||||
1. Adding a `PackageReference`
|
||||
1. Changing a `PackageReference`
|
||||
1. Changing a `PackageVersion`
|
||||
|
||||
Note that these changes might be from direct changing of the xml in our msbuild files, or through some gesture in an IDE, or through a CLI command that manipulates nuget package references or versions.
|
||||
|
||||
The failure may be observed either during an automated operation that makes any of the above changes, or during a subsequent nuget restore operation.
|
||||
|
||||
The error will look something like this:
|
||||
|
||||
> C:\Program Files\dotnet\sdk\7.0.103\NuGet.targets(132,5): error : Failed to download package 'Nerdbank.GitVersioning.3.6.79-alpha' from 'https://pkgs.dev.azure.com/azure-public/3ccf6661-f8ce-4e8a-bb2e-eff943ddd3c7/_packaging/36a629e1-6c5b-4bcd-aa2e-6018802d6b99/nuget/v3/flat2/nerdbank.gitversioning/3.6.79-alpha/nerdbank.gitversioning.3.6.79-alpha.nupkg'. [C:\Users\andarno\source\repos\Library.Template\Library.sln]
|
||||
>
|
||||
> C:\Program Files\dotnet\sdk\7.0.103\NuGet.targets(132,5): **error : Response status code does not indicate success: 401 (Unauthorized - No local versions of package 'nerdbank.gitversioning'; please provide authentication to access versions from upstream that have not yet been saved to your feed.** (DevOps Activity ID: 8D41B3A3-E551-4F6C-BEFA-10C758EA8093)). [C:\Users\andarno\source\repos\Library.Template\Library.sln]
|
||||
>
|
||||
> C:\Program Files\dotnet\sdk\7.0.103\NuGet.targets(132,5): error : Restore canceled! [C:\Users\andarno\source\repos\Library.Template\Library.sln]
|
||||
|
||||
Note the bolded portion, but you can disregard the particular package id used in that sample.
|
||||
|
||||
When you see this, it means the restore operation cannot find the version of the package you requested in one of our Azure Artifact public feeds.
|
||||
This document will help get you unblocked.
|
||||
|
||||
## The mitigation
|
||||
|
||||
There are several possible mitigations, which are enumerated below.
|
||||
The high-level solution that they all have in common is to get the package version you requested into your local package cache.
|
||||
This will allow nuget restore in the repo to succeed.
|
||||
You can then continue to build, develop, and test your changes and (at your option) send a pull request to our repo with your changes (and thank you!).
|
||||
When your pull request is merged into our repo, the package dependency you introduced is added to our Azure Artifacts feed so that you and others will see restore Just Work without extra steps.
|
||||
|
||||
All these mitigations assume you have access to the package of interest through nuget.org.
|
||||
|
||||
Each sub-section below outlines steps you can take to get unblocked.
|
||||
It is only necessary to follow the steps in _one_ of the subsections.
|
||||
|
||||
### Populate your local package cache via another repo
|
||||
|
||||
In some temporary, empty directory on your machine (that is *not* within our repo), run these commands:
|
||||
|
||||
```
|
||||
dotnet new classlib
|
||||
dotnet new nugetconfig
|
||||
dotnet add package <packageId> -v <packageVersion>
|
||||
```
|
||||
|
||||
This will populate your local nuget package cache with the exact package version you need.
|
||||
You can now delete this temporary directory.
|
||||
|
||||
Running restore in the Microsoft OSS repo should now be able to find that package.
|
||||
|
||||
### Modify nuget.config within your clone of the Microsoft repo
|
||||
|
||||
If the `nuget.config` file found at the root of the repo does not have nuget.org listed as a feed source, add it:
|
||||
|
||||
```xml
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
||||
```
|
||||
|
||||
You should *not* commit this change as it will not be necessary for your pull request to build successfully and merge.
|
||||
Changes to nuget.config that are included in your pull request will likely need to be reverted and delay merging of your changes.
|
||||
|
||||
If the `nuget.config` file has a `<packageSourceMapping>` element inside it, you may need to add a section to it so nuget restore is willing to restore your package from nuget.org.
|
||||
You can learn more about [package source mappings](https://learn.microsoft.com/nuget/consume-packages/package-source-mapping) in our docs.
|
||||
|
||||
For example, if you added nuget.org as a feed source yourself, you should add it to the mapping, along with the ID of the package you are changing:
|
||||
|
||||
```diff
|
||||
<packageSourceMapping>
|
||||
<packageSource key="test-tools">
|
||||
<package pattern="Microsoft.CodeCoverage" />
|
||||
</packageSource>
|
||||
+ <packageSource key="nuget">
|
||||
+ <package pattern="Nerdbank.GitVersioning" />
|
||||
+ </packageSource>
|
||||
<packageSource key="msft_consumption">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
```
|
||||
|
||||
Or if nuget.org was already in the nuget.config file, you may need to just add the package ID to the inclusion list:
|
||||
|
||||
```diff
|
||||
<packageSourceMapping>
|
||||
<packageSource key="test-tools">
|
||||
<package pattern="Microsoft.CodeCoverage" />
|
||||
</packageSource>
|
||||
<packageSource key="nuget">
|
||||
<package pattern="System.Memory" />
|
||||
+ <package pattern="Nerdbank.GitVersioning" />
|
||||
</packageSource>
|
||||
<packageSource key="msft_consumption">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
```
|
||||
|
||||
Running restore in the Microsoft OSS repo should now be able to find that package.
|
||||
You can revert the nuget.config file change after running a successful restore locally.
|
|
@ -1,2 +0,0 @@
|
|||
User-agent: *
|
||||
Disallow:
|
|
@ -1,70 +0,0 @@
|
|||
---
|
||||
title: #Required; page title is displayed in search results. Include the brand.
|
||||
description: #Required; article description that is displayed in search results.
|
||||
author: #Required; your GitHub user alias, with correct capitalization.
|
||||
ms.author: #Required; microsoft alias of author; optional team alias.
|
||||
ms.technology: vs-ide-sdk
|
||||
ms.topic: conceptual #Required; leave this attribute/value as-is.
|
||||
ms.date: #Required; mm/dd/yyyy format.
|
||||
ms.custom: template-concept #Required; leave this attribute/value as-is.
|
||||
---
|
||||
|
||||
<!--Remove all the comments in this template before you sign-off or merge to the
|
||||
main branch.
|
||||
|
||||
This template provides the basic structure of a Concept article pattern. See the [instructions - Concept](../level4/article-concept.md) in the pattern library.
|
||||
|
||||
To provide feedback on this template contact
|
||||
[the templates workgroup](mailto:ghogen@microsoft.com).
|
||||
-->
|
||||
|
||||
<!-- 1. H1
|
||||
Required. Set expectations for what the content covers, so customers know the
|
||||
content meets their needs. Should NOT begin with a verb.
|
||||
-->
|
||||
|
||||
# [H1 heading here] concepts
|
||||
|
||||
<!-- 2. Introductory paragraph
|
||||
Required. Lead with a light intro that describes what the article covers. Answer the
|
||||
fundamental “why would I want to know this?” question. Keep it short.
|
||||
-->
|
||||
|
||||
[add your introductory paragraph]
|
||||
|
||||
<!-- 3. In-topic TOC -->
|
||||
|
||||
## In this article
|
||||
|
||||
- [Section 1 heading](#section-1-heading)
|
||||
- [Section 2 heading](#section-2-heading)
|
||||
- etc.
|
||||
|
||||
<!-- 4. H2s
|
||||
Required. Give each H2 a heading that sets expectations for the content that follows.
|
||||
Follow the H2 headings with a sentence about how the section contributes to the whole.
|
||||
-->
|
||||
|
||||
## [Section 1 heading]
|
||||
<!-- add your content here -->
|
||||
|
||||
## [Section 2 heading]
|
||||
<!-- add your content here -->
|
||||
|
||||
## [Section n heading]
|
||||
<!-- add your content here -->
|
||||
|
||||
<!-- 5. Next steps
|
||||
Required. Provide at least one next step and no more than three. Include some
|
||||
context so the customer can determine why they would click the link.
|
||||
-->
|
||||
|
||||
## Next steps
|
||||
<!-- Add a context sentence for the following links, e.g. "Learn more about ..." -->
|
||||
- [Write concepts](article-concept.md)
|
||||
- [Links](../contribute/links-how-to.md)
|
||||
|
||||
<!--
|
||||
Remove all the comments in this template before you sign-off or merge to the
|
||||
main branch.
|
||||
-->
|
|
@ -1,82 +0,0 @@
|
|||
---
|
||||
title: #Required; page title displayed in search results. Include the brand.
|
||||
description: #Required; article description that is displayed in search results.
|
||||
author: #Required; your GitHub user alias, with correct capitalization.
|
||||
ms.author: #Required; microsoft alias of author; optional team alias.
|
||||
ms.technology: vs-ide-sdk
|
||||
ms.topic: overview #Required
|
||||
ms.date: #Required; mm/dd/yyyy format.
|
||||
---
|
||||
|
||||
<!--
|
||||
Remove all the comments in this template before you sign-off or merge to the
|
||||
main branch.
|
||||
|
||||
This template provides the basic structure of a Overview article pattern. See the [instructions - Overview](../level4/article-overview.md) in the pattern library.
|
||||
|
||||
You can provide feedback about this template at: mailto:ghogen@microsoft.com
|
||||
|
||||
1. H1 -----------------------------------------------------------------------------
|
||||
|
||||
Required: For the H1 - that's the primary heading at the top of the article. Use the word "overview" for consistency after the feature or service.
|
||||
-->
|
||||
|
||||
<!---
|
||||
--->
|
||||
|
||||
# <area> overview
|
||||
TODO: Add your heading
|
||||
|
||||
<!-- 2. Introductory paragraph ----------------------------------------------------------
|
||||
|
||||
Required: The introductory paragraph helps customers quickly determine whether an article is relevant.
|
||||
Describe in customer-friendly terms what the or feature is and does, and why the customer should care. Keep it short for the intro.
|
||||
You can go into more detail later in the article. Many services add artwork or videos below the introduction.
|
||||
-->
|
||||
|
||||
[Introductory paragraph]
|
||||
TODO: Add your introductory paragraph
|
||||
|
||||
<!---Avoid notes, tips, and important boxes. Readers tend to skip over them. Better to put that info directly into the article text.--->
|
||||
|
||||
<!-- 3. In-topic TOC -->
|
||||
|
||||
## In this article
|
||||
|
||||
- [Section 1 heading](#section-1-heading)
|
||||
- [Section 2 heading](#section-2-heading)
|
||||
- etc.
|
||||
|
||||
|
||||
<!-- 4. Article body ------------------------------------------------------------
|
||||
Required: After the intro, you can develop your overview by discussing the features that answer the "Why should I care" question with a bit more depth.
|
||||
Be sure to call out any basic requirements and dependencies, as well as limitations or overhead.
|
||||
Don't catalog every feature, and some may only need to be mentioned as available, without any discussion.
|
||||
-->
|
||||
|
||||
[Article body]
|
||||
TODO: Add your article body
|
||||
|
||||
<!-- 5. Top tasks ------------------------------------------------------------------------------
|
||||
|
||||
Suggested:
|
||||
An effective way to structure you overview article is to create an H2 for the top customer tasks you identified during the planning process and describe how the product/service helps customers with that task.
|
||||
|
||||
Create a new H2 for each task you list. Task
|
||||
headings should start with an imperative verb, not a gerund (-ing form), e.g. "Configure a command" not "Configuring a command".
|
||||
|
||||
Use H3s for subareas within each task to break up.
|
||||
--->
|
||||
|
||||
## Task heading
|
||||
|
||||
<!-- 6. Next steps ------------------------------------------------------------------------
|
||||
|
||||
Required: In Overview articles, provide at least one next step.
|
||||
Next steps in overview articles will often link to a tutorial or a conceptual article.
|
||||
What you link to will depend on what is really a next step for the customer.
|
||||
Do not use a "More info section" or a "Resources section" or a "See also section".
|
||||
--->
|
||||
|
||||
## Next steps
|
||||
TODO: Add your next step link(s)
|
Загрузка…
Ссылка в новой задаче