From 8a5375eb89bca7dbb58dbaceb1d23eee082e7883 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 11 Jul 2023 13:19:14 -0700 Subject: [PATCH 01/23] Implement json serialization/deserialization for LSP json messages. Follows the same patterns as the existing library we use. However, while the types are the same, the namespace is different so as to not conflict. --- ...lassificationTaggerProvider.TagComputer.cs | 7 +- .../Core/Extensions/LSPExtensions.cs | 27 + .../Api/AbstractVSTypeScriptRequestHandler.cs | 2 +- .../Api/IVSTypeScriptCapabilitiesProvider.cs | 3 +- .../VSTypeScriptInProcLanguageClient.cs | 3 +- .../AbstractInProcLanguageClient.cs | 2 +- .../AlwaysActivateInProcLanguageClient.cs | 4 +- .../EditorHoverCreationService.cs | 2 +- ...ditorLspCompletionResultCreationService.cs | 7 +- ...ditorLspReferencesResultCreationService.cs | 14 +- ...itorLspSymbolInformationCreationService.cs | 4 +- .../LiveShareInProcLanguageClient.cs | 4 +- .../RazorInProcLanguageClient.cs | 3 +- ...rverProtocolTests.InitializationOptions.cs | 2 +- .../AbstractLanguageServerProtocolTests.cs | 8 +- .../ServiceBrokerConnectHandler.cs | 6 - .../ServerCapabilitiesProvider.cs | 2 +- .../CapabilitiesManager.cs | 2 +- .../ExampleLanguageServer.cs | 2 +- ...ageServerProtocol.Framework.Example.csproj | 1 - .../MultiRegisteringHandler.cs | 2 +- .../ExampleTests.cs | 2 +- .../TestExampleLanguageServer.cs | 5 +- .../.editorconfig | 4 + .../LSPFrameworkResources.Designer.cs | 126 +++ .../LSPFrameworkResources.resx | 122 +++ ...monLanguageServerProtocol.Framework.csproj | 14 + .../Protocol/ApplyWorkspaceEditParams.cs | 39 + .../Protocol/ApplyWorkspaceEditResponse.cs | 39 + .../Protocol/ClientCapabilities.cs | 51 + .../Protocol/CodeAction.cs | 85 ++ .../Protocol/CodeActionContext.cs | 50 + .../Protocol/CodeActionKind.cs | 74 ++ .../Protocol/CodeActionKindSetting.cs | 27 + .../Protocol/CodeActionLiteralSetting.cs | 27 + .../Protocol/CodeActionOptions.cs | 56 ++ .../Protocol/CodeActionParams.cs | 47 + .../CodeActionResolveSupportSetting.cs | 28 + .../Protocol/CodeActionSetting.cs | 55 ++ .../Protocol/CodeActionTriggerKind.cs | 28 + .../Protocol/CodeDescription.cs | 76 ++ .../Protocol/CodeLens.cs | 50 + .../Protocol/CodeLensOptions.cs | 40 + .../Protocol/CodeLensParams.cs | 27 + .../Protocol/CodeLensWorkspaceSetting.cs | 25 + .../Protocol/Color.cs | 53 ++ .../Protocol/ColorInformation.cs | 29 + .../Protocol/Command.cs | 51 + .../Protocol/CompletionContext.cs | 39 + .../Protocol/CompletionItem.cs | 209 +++++ .../Protocol/CompletionItemKind.cs | 208 ++++ .../Protocol/CompletionItemKindSetting.cs | 29 + .../Protocol/CompletionItemLabelDetails.cs | 40 + .../Protocol/CompletionItemOptions.cs | 29 + .../Protocol/CompletionItemSetting.cs | 128 +++ .../Protocol/CompletionItemTag.cs | 19 + .../CompletionItemTagSupportSetting.cs | 27 + .../Protocol/CompletionList.cs | 51 + .../Protocol/CompletionListItemDefaults.cs | 72 ++ .../Protocol/CompletionListSetting.cs | 29 + .../Protocol/CompletionOptions.cs | 73 ++ .../Protocol/CompletionParams.cs | 41 + .../Protocol/CompletionSetting.cs | 73 ++ .../Protocol/CompletionTriggerKind.cs | 32 + .../Protocol/ConfigurationItem.cs | 42 + .../Protocol/ConfigurationParams.cs | 27 + .../Converters/DocumentUriConverter.cs | 59 ++ .../JsonConverterCollectionUtilities.cs | 19 + .../Protocol/Converters/KindAttribute.cs | 40 + .../ParameterInformationConverter.cs | 65 ++ .../Converters/StringEnumConverter.cs | 102 ++ .../Protocol/Converters/SumConverter.cs | 269 ++++++ .../Converters/TextDocumentSyncConverter.cs | 99 ++ .../Protocol/CreateFile.cs | 49 + .../Protocol/CreateFileOptions.cs | 40 + .../Protocol/CustomDictionary.xml | 7 + .../Protocol/DefaultBehaviorPrepareRename.cs | 30 + .../Protocol/DefinitionOptions.cs | 29 + .../Protocol/DeleteFile.cs | 49 + .../Protocol/DeleteFileOptions.cs | 41 + .../Protocol/Diagnostic.cs | 171 ++++ .../Protocol/DiagnosticOptions.cs | 59 ++ .../Protocol/DiagnosticRegistrationOptions.cs | 39 + .../Protocol/DiagnosticRelatedInformation.cs | 31 + .../DiagnosticServerCancellationData.cs | 26 + .../Protocol/DiagnosticSetting.cs | 24 + .../Protocol/DiagnosticSeverity.cs | 34 + .../Protocol/DiagnosticTag.cs | 27 + .../Protocol/DiagnosticWorkspaceSetting.cs | 24 + .../Protocol/DidChangeConfigurationParams.cs | 27 + .../Protocol/DidChangeTextDocumentParams.cs | 42 + .../Protocol/DidChangeWatchedFilesParams.cs | 28 + .../Protocol/DidCloseTextDocumentParams.cs | 27 + .../Protocol/DidOpenTextDocumentParams.cs | 27 + .../Protocol/DidSaveTextDocumentParams.cs | 39 + .../Protocol/DocumentColorOptions.cs | 29 + .../Protocol/DocumentColorParams.cs | 27 + .../Protocol/DocumentDiagnosticParams.cs | 65 ++ .../Protocol/DocumentDiagnosticReportKind.cs | 23 + .../DocumentDiagnosticReportPartialResult.cs | 28 + .../Protocol/DocumentFilter.cs | 51 + .../Protocol/DocumentFormattingOptions.cs | 29 + .../Protocol/DocumentFormattingParams.cs | 37 + .../Protocol/DocumentHighlight.cs | 44 + .../Protocol/DocumentHighlightKind.cs | 32 + .../Protocol/DocumentHighlightOptions.cs | 29 + .../Protocol/DocumentHighlightParams.cs | 31 + .../Protocol/DocumentLink.cs | 41 + .../Protocol/DocumentLinkOptions.cs | 40 + .../Protocol/DocumentLinkParams.cs | 27 + .../DocumentOnTypeFormattingOptions.cs | 39 + .../DocumentOnTypeFormattingParams.cs | 37 + .../DocumentRangeFormattingOptions.cs | 29 + .../Protocol/DocumentRangeFormattingParams.cs | 47 + .../Protocol/DocumentSymbol.cs | 96 ++ .../Protocol/DocumentSymbolOptions.cs | 29 + .../Protocol/DocumentSymbolParams.cs | 27 + .../Protocol/DocumentSymbolSetting.cs | 40 + .../Protocol/DynamicRegistrationSetting.cs | 43 + .../Protocol/ExecuteCommandOptions.cs | 39 + .../Protocol/ExecuteCommandParams.cs | 39 + .../Converters/VSExtensionConverter.cs | 41 + .../Converters/VSExtensionUtilities.cs | 57 ++ .../Protocol/Extensions/VSDiagnostic.cs | 68 ++ .../VSDiagnosticProjectInformation.cs | 38 + .../Protocol/Extensions/VSDiagnosticRank.cs | 37 + .../Protocol/Extensions/VSDiagnosticTags.cs | 63 ++ .../Extensions/VSGetProjectContextsParams.cs | 26 + .../Protocol/Extensions/VSImageId.cs | 62 ++ .../Protocol/Extensions/VSLocation.cs | 32 + .../Protocol/Extensions/VSMethods.cs | 28 + .../Protocol/Extensions/VSProjectContext.cs | 96 ++ .../Extensions/VSProjectContextList.cs | 36 + .../Protocol/Extensions/VSProjectKind.cs | 30 + .../Extensions/VSServerCapabilities.cs | 29 + .../Extensions/VSSymbolInformation.cs | 37 + .../Extensions/VSTextDocumentIdentifier.cs | 88 ++ .../Protocol/FileChangeType.cs | 29 + .../Protocol/FileEvent.cs | 40 + .../Protocol/FoldingRange.cs | 82 ++ .../Protocol/FoldingRangeKind.cs | 36 + .../Protocol/FoldingRangeOptions.cs | 29 + .../Protocol/FoldingRangeParams.cs | 27 + .../Protocol/FoldingRangeSetting.cs | 51 + .../Protocol/FoldingRangeSettingOptions.cs | 29 + .../Protocol/FormattingOptions.cs | 50 + .../Protocol/FullDocumentDiagnosticReport.cs | 45 + .../Protocol/Hover.cs | 42 + .../Protocol/HoverOptions.cs | 29 + .../Protocol/HoverSetting.cs | 29 + .../Protocol/IPartialResultParams.cs | 26 + .../Protocol/IStaticRegistrationOptions.cs | 18 + .../Protocol/IStringEnum.cs | 21 + .../Protocol/ISumType.cs | 19 + .../Protocol/ITextDocumentParams.cs | 20 + .../Protocol/ITextDocumentPositionParams.cs | 32 + .../ITextDocumentRegistrationOptions.cs | 18 + .../Protocol/IWorkDoneProgressOptions.cs | 23 + .../Protocol/ImplementationOptions.cs | 29 + .../Protocol/InitializeError.cs | 27 + .../Protocol/InitializeErrorCode.cs | 22 + .../Protocol/InitializeParams.cs | 108 +++ .../Protocol/InitializeResult.cs | 27 + .../Protocol/InitializedParams.cs | 15 + .../Protocol/InlayHint.cs | 104 ++ .../Protocol/InlayHintKind.cs | 27 + .../Protocol/InlayHintLabelPart.cs | 61 ++ .../Protocol/InlayHintOptions.cs | 40 + .../Protocol/InlayHintParams.cs | 37 + .../Protocol/InlayHintRegistrationOptions.cs | 40 + .../InlayHintResolveSupportSetting.cs | 27 + .../Protocol/InlayHintSetting.cs | 30 + .../Protocol/InlayHintWorkspaceSetting.cs | 25 + .../Protocol/InsertReplaceEdit.cs | 47 + .../Protocol/InsertReplaceRange.cs | 35 + .../Protocol/InsertTextFormat.cs | 24 + .../Protocol/InsertTextMode.cs | 24 + .../Protocol/InsertTextModeSupportSetting.cs | 27 + .../ClassifiedTextElementConverter.cs | 84 ++ .../Converters/ClassifiedTextRunConverter.cs | 91 ++ .../Converters/ContainerElementConverter.cs | 87 ++ .../Converters/DropProgressConverter.cs | 52 + .../Converters/ImageElementConverter.cs | 74 ++ .../Internal/Converters/ImageIdConverter.cs | 72 ++ .../Converters/ObjectContentConverter.cs | 116 +++ .../Internal/Converters/RegexConverter.cs | 49 + .../VSInternalExtensionUtilities.cs | 73 ++ .../Diagnostics/VSInternalDiagnosticKind.cs | 25 + .../VSInternalDiagnosticOptions.cs | 53 ++ .../Diagnostics/VSInternalDiagnosticParams.cs | 53 ++ .../Diagnostics/VSInternalDiagnosticReport.cs | 77 ++ .../VSInternalDocumentDiagnosticsParams.cs | 31 + .../VSInternalWorkspaceDiagnosticReport.cs | 21 + .../VSInternalWorkspaceDiagnosticsParams.cs | 45 + .../Efficiency/OptimizedVSCompletionList.cs | 43 + .../OptimizedVSCompletionListJsonConverter.cs | 267 ++++++ .../Internal/Text/ClassifiedTextElement.cs | 41 + .../Internal/Text/ClassifiedTextRun.cs | 54 ++ .../Internal/Text/ClassifiedTextRunStyle.cs | 55 ++ .../Internal/Text/ContainerElement.cs | 31 + .../Internal/Text/ContainerElementStyle.cs | 28 + .../Protocol/Internal/Text/ImageElement.cs | 29 + .../Protocol/Internal/Text/ImageId.cs | 104 ++ .../Internal/VSFoldingRangeSetting.cs | 26 + .../Internal/VSInternalClientCapabilities.cs | 73 ++ .../Internal/VSInternalClipboardContent.cs | 35 + .../Protocol/Internal/VSInternalCodeAction.cs | 72 ++ .../Internal/VSInternalCodeActionContext.cs | 28 + .../Internal/VSInternalCodeActionGroup.cs | 47 + .../VSInternalCodeActionGroupSetting.cs | 25 + .../VSInternalCodeActionLiteralSetting.cs | 27 + .../Internal/VSInternalCommitCharacter.cs | 27 + .../Internal/VSInternalCompletionContext.cs | 32 + .../VSInternalCompletionInvokeKind.cs | 31 + .../Internal/VSInternalCompletionItem.cs | 56 ++ .../Internal/VSInternalCompletionList.cs | 66 ++ .../VSInternalCompletionListSetting.cs | 40 + .../Internal/VSInternalCompletionSetting.cs | 27 + .../VSInternalContinueCharacterClass.cs | 30 + .../VSInternalContinueCharacterRange.cs | 37 + .../VSInternalContinueCharacterSingle.cs | 30 + .../VSInternalDocumentOnAutoInsertOptions.cs | 25 + .../VSInternalDocumentOnAutoInsertParams.cs | 55 ++ ...nternalDocumentOnAutoInsertResponseItem.cs | 43 + .../VSInternalDocumentSpellCheckableParams.cs | 30 + ...nternalExecuteCommandClientCapabilities.cs | 41 + .../Protocol/Internal/VSInternalHover.cs | 29 + .../Internal/VSInternalIconMapping.cs | 132 +++ .../VSInternalInlineCompletionContext.cs | 33 + .../VSInternalInlineCompletionItem.cs | 48 + .../VSInternalInlineCompletionList.cs | 24 + .../VSInternalInlineCompletionOptions.cs | 26 + .../VSInternalInlineCompletionRequest.cs | 44 + .../VSInternalInlineCompletionTriggerKind.cs | 26 + .../Protocol/Internal/VSInternalItemOrigin.cs | 47 + .../Internal/VSInternalKindAndModifier.cs | 115 +++ .../Internal/VSInternalKnownKindModifiers.cs | 75 ++ .../Protocol/Internal/VSInternalKnownKinds.cs | 267 ++++++ .../Protocol/Internal/VSInternalLocation.cs | 46 + .../Protocol/Internal/VSInternalMethods.cs | 122 +++ .../VSInternalMultipleContextFeatures.cs | 27 + .../Internal/VSInternalPriorityLevel.cs | 32 + .../Internal/VSInternalProjectContext.cs | 81 ++ .../Internal/VSInternalReferenceItem.cs | 195 ++++ .../Internal/VSInternalReferenceKind.cs | 104 ++ .../Internal/VSInternalReferenceParams.cs | 26 + .../VSInternalRenameOptionSelection.cs | 38 + .../Internal/VSInternalRenameOptionSupport.cs | 49 + .../Internal/VSInternalRenameParams.cs | 28 + .../Internal/VSInternalRenameRange.cs | 28 + .../VSInternalResolutionStatusKind.cs | 32 + .../VSInternalSelectedCompletionInfo.cs | 45 + .../Internal/VSInternalServerCapabilities.cs | 168 ++++ .../VSInternalSignatureInformation.cs | 29 + .../Internal/VSInternalSnippetSupportLevel.cs | 22 + .../VSInternalSpellCheckableRangeKind.cs | 27 + .../VSInternalSpellCheckableRangeReport.cs | 67 ++ .../Internal/VSInternalStreamingParams.cs | 47 + .../Internal/VSInternalSymbolInformation.cs | 26 + ...SInternalTextDocumentClientCapabilities.cs | 26 + ...InternalTextDocumentRegistrationOptions.cs | 27 + .../VSInternalTextPresentationParams.cs | 48 + .../VSInternalUriPresentationParams.cs | 50 + .../VSInternalValidateBreakableRangeParams.cs | 27 + .../VSInternalWellKnownCodeActionCommands.cs | 22 + ...VSInternalWorkspaceSpellCheckableParams.cs | 37 + ...VSInternalWorkspaceSpellCheckableReport.cs | 24 + .../Protocol/LanguageServer.Protocol.csproj | 59 ++ .../Protocol/LanguageServer.Protocol.ruleset | 44 + .../Protocol/LinkedEditingRangeOptions.cs | 29 + .../Protocol/LinkedEditingRangeParams.cs | 18 + .../Protocol/LinkedEditingRanges.cs | 39 + .../Protocol/Location.cs | 64 ++ .../Protocol/LogMessageParams.cs | 37 + .../Protocol/LspNotification.cs | 27 + .../Protocol/LspRequest.cs | 28 + .../Protocol/MarkedString.cs | 40 + .../Protocol/MarkupContent.cs | 37 + .../Protocol/MarkupKind.cs | 31 + .../Protocol/MaybeNullWhenAttribute.cs | 24 + .../Protocol/MessageActionItem.cs | 27 + .../Protocol/MessageType.cs | 37 + .../Protocol/Methods.cs | 603 ++++++++++++ ...OptionalVersionedTextDocumentIdentifier.cs | 87 ++ .../Protocol/ParameterInformation.cs | 41 + .../Protocol/ParameterInformationSetting.cs | 29 + .../Protocol/Position.cs | 121 +++ .../Protocol/PrepareRenameParams.cs | 37 + .../Protocol/PrepareSupportDefaultBehavior.cs | 22 + .../Protocol/PreviousResultId.cs | 39 + .../Protocol/PublishDiagnosticParams.cs | 40 + .../Protocol/PublishDiagnosticsSetting.cs | 29 + .../Protocol/Range.cs | 86 ++ .../Protocol/ReferenceContext.cs | 27 + .../Protocol/ReferenceOptions.cs | 29 + .../Protocol/ReferenceParams.cs | 43 + .../Protocol/Registration.cs | 49 + .../Protocol/RegistrationParams.cs | 27 + .../RelatedFullDocumentDiagnosticReport.cs | 31 + ...elatedUnchangedDocumentDiagnosticReport.cs | 31 + .../Protocol/RenameClientCapabilities.cs | 57 ++ .../Protocol/RenameFile.cs | 60 ++ .../Protocol/RenameFileOptions.cs | 40 + .../Protocol/RenameOptions.cs | 40 + .../Protocol/RenameParams.cs | 27 + .../Protocol/RenameRange.cs | 40 + .../Protocol/ResolveSupportSetting.cs | 27 + .../Protocol/ResourceOperationKind.cs | 36 + .../Protocol/SaveOptions.cs | 29 + .../SemanticTokens/SemanticTokenFormat.cs | 26 + .../SemanticTokens/SemanticTokenModifiers.cs | 81 ++ .../SemanticTokens/SemanticTokenTypes.cs | 154 +++ .../Protocol/SemanticTokens/SemanticTokens.cs | 31 + .../SemanticTokens/SemanticTokensDelta.cs | 34 + .../SemanticTokensDeltaParams.cs | 44 + .../SemanticTokensDeltaPartialResult.cs | 26 + .../SemanticTokens/SemanticTokensEdit.cs | 51 + .../SemanticTokensFullOptions.cs | 29 + .../SemanticTokens/SemanticTokensLegend.cs | 37 + .../SemanticTokens/SemanticTokensOptions.cs | 49 + .../SemanticTokens/SemanticTokensParams.cs | 36 + .../SemanticTokensPartialResult.cs | 23 + .../SemanticTokensRangeParams.cs | 23 + .../SemanticTokensRequestsFullSetting.cs | 28 + .../SemanticTokensRequestsSetting.cs | 36 + .../SemanticTokens/SemanticTokensSetting.cs | 59 ++ .../SemanticTokensWorkspaceSetting.cs | 32 + .../Protocol/ServerCapabilities.cs | 315 +++++++ .../Protocol/ShowMessageParams.cs | 37 + .../Protocol/ShowMessageRequestParams.cs | 29 + .../Protocol/SignatureHelp.cs | 51 + .../Protocol/SignatureHelpContext.cs | 61 ++ .../Protocol/SignatureHelpOptions.cs | 52 + .../Protocol/SignatureHelpParams.cs | 29 + .../Protocol/SignatureHelpSetting.cs | 41 + .../Protocol/SignatureHelpTriggerKind.cs | 32 + .../Protocol/SignatureInformation.cs | 50 + .../Protocol/SignatureInformationSetting.cs | 40 + .../Protocol/SumType.cs | 888 ++++++++++++++++++ .../Protocol/SymbolInformation.cs | 88 ++ .../Protocol/SymbolKind.cs | 149 +++ .../Protocol/SymbolKindSetting.cs | 29 + .../Protocol/SymbolSetting.cs | 29 + .../Protocol/SynchronizationSetting.cs | 51 + .../Protocol/TagSupport.cs | 27 + .../TextDocumentClientCapabilities.cs | 270 ++++++ .../TextDocumentContentChangeEvent.cs | 49 + .../Protocol/TextDocumentEdit.cs | 37 + .../Protocol/TextDocumentIdentifier.cs | 83 ++ .../Protocol/TextDocumentItem.cs | 60 ++ .../Protocol/TextDocumentPositionParams.cs | 37 + .../TextDocumentRegistrationOptions.cs | 29 + .../Protocol/TextDocumentSaveReason.cs | 33 + .../Protocol/TextDocumentSyncKind.cs | 32 + .../Protocol/TextDocumentSyncOptions.cs | 75 ++ .../Protocol/TextEdit.cs | 37 + .../Protocol/TraceSetting.cs | 34 + .../Protocol/TypeDefinitionOptions.cs | 29 + .../UnchangedDocumentDiagnosticReport.cs | 33 + .../Protocol/Unregistration.cs | 37 + .../Protocol/UnregistrationParams.cs | 27 + .../VersionedTextDocumentIdentifier.cs | 86 ++ .../Protocol/WillSaveTextDocumentParams.cs | 37 + .../Protocol/WorkspaceClientCapabilities.cs | 139 +++ .../Protocol/WorkspaceDiagnosticParams.cs | 54 ++ .../Protocol/WorkspaceDiagnosticReport.cs | 28 + .../WorkspaceDiagnosticReportPartialResult.cs | 28 + .../Protocol/WorkspaceEdit.cs | 41 + .../Protocol/WorkspaceEditSetting.cs | 40 + .../WorkspaceFullDocumentDiagnosticReport.cs | 41 + .../Protocol/WorkspaceSymbolOptions.cs | 29 + .../Protocol/WorkspaceSymbolParams.cs | 40 + ...kspaceUnchangedDocumentDiagnosticReport.cs | 41 + .../xlf/LSPFrameworkResources.cs.xlf | 42 + .../xlf/LSPFrameworkResources.de.xlf | 42 + .../xlf/LSPFrameworkResources.es.xlf | 42 + .../xlf/LSPFrameworkResources.fr.xlf | 42 + .../xlf/LSPFrameworkResources.it.xlf | 42 + .../xlf/LSPFrameworkResources.ja.xlf | 42 + .../xlf/LSPFrameworkResources.ko.xlf | 42 + .../xlf/LSPFrameworkResources.pl.xlf | 42 + .../xlf/LSPFrameworkResources.pt-BR.xlf | 42 + .../xlf/LSPFrameworkResources.ru.xlf | 42 + .../xlf/LSPFrameworkResources.tr.xlf | 42 + .../xlf/LSPFrameworkResources.zh-Hans.xlf | 42 + .../xlf/LSPFrameworkResources.zh-Hant.xlf | 42 + .../Protocol/DefaultCapabilitiesProvider.cs | 4 +- .../Protocol/Extensions/Extensions.cs | 4 +- .../Extensions/ProtocolConversions.cs | 4 +- .../Protocol/Handler/AbstractRefreshQueue.cs | 2 +- .../ValidateBreakableRangeHandler.cs | 4 +- .../Handler/ClientCapabilitiesManager.cs | 2 +- .../Handler/CodeActions/CodeActionHelpers.cs | 4 +- .../CodeActions/CodeActionResolveData.cs | 2 +- .../CodeActions/CodeActionResolveHandler.cs | 4 +- .../Handler/CodeActions/CodeActionsHandler.cs | 4 +- .../Handler/CodeLens/CodeLensHandler.cs | 2 +- .../Handler/CodeLens/CodeLensRefreshQueue.cs | 2 +- .../Handler/CodeLens/CodeLensResolveData.cs | 2 +- .../CodeLens/CodeLensResolveHandler.cs | 2 +- .../AbstractExecuteWorkspaceCommandHandler.cs | 2 +- ...tractLspCompletionResultCreationService.cs | 2 +- .../Completion/CompletionCapabilityHelper.cs | 2 +- .../Handler/Completion/CompletionHandler.cs | 2 +- .../Handler/Completion/CompletionListCache.cs | 2 +- .../Completion/CompletionResolveData.cs | 2 +- .../Completion/CompletionResolveHandler.cs | 2 +- ...faultLspCompletionResultCreationService.cs | 2 +- .../ILspCompletionResultCreationService.cs | 2 +- ...dChangeConfigurationNotificationHandler.cs | 4 +- ...rationNotificationHandler_OnInitialized.cs | 2 +- .../AbstractGoToDefinitionHandler.cs | 4 +- .../Definitions/GoToDefinitionHandler.cs | 2 +- .../Definitions/GoToTypeDefinitionHandler.cs | 2 +- .../AbstractPullDiagnosticHandler.cs | 4 +- .../AbstractDocumentDiagnosticSource.cs | 2 +- .../DiagnosticSources/IDiagnosticSource.cs | 2 +- .../ProjectDiagnosticSource.cs | 2 +- .../Diagnostics/DiagnosticsRefreshQueue.cs | 2 +- .../DocumentPullDiagnosticHandler.cs | 4 +- ...licDocumentPullDiagnosticHandlerFactory.cs | 2 +- .../PublicDocumentPullDiagnosticsHandler.cs | 6 +- .../PublicWorkspacePullDiagnosticsHandler.cs | 6 +- .../Diagnostics/PullDiagnosticCategories.cs | 2 +- .../WorkspacePullDiagnosticHandler.cs | 4 +- .../DocumentChanges/DidChangeHandler.cs | 4 +- .../DocumentChanges/DidCloseHandler.cs | 4 +- .../Handler/DocumentChanges/DidOpenHandler.cs | 2 +- .../FoldingRanges/FoldingRangesHandler.cs | 2 +- .../AbstractFormatDocumentHandlerBase.cs | 2 +- .../Formatting/FormatDocumentHandler.cs | 2 +- .../Formatting/FormatDocumentOnTypeHandler.cs | 2 +- .../Formatting/FormatDocumentRangeHandler.cs | 2 +- .../Highlights/DocumentHighlightHandler.cs | 2 +- .../Protocol/Handler/Hover/HoverHandler.cs | 2 +- .../Hover/ILspHoverResultCreationService.cs | 2 +- .../Handler/IClientCapabilitiesManager.cs | 2 +- .../Handler/IDocumentChangeTracker.cs | 2 +- .../Handler/ILspServiceRequestHandler.cs | 2 +- .../Handler/InlayHint/InlayHintCache.cs | 2 +- .../Handler/InlayHint/InlayHintHandler.cs | 4 +- .../InlayHint/InlayHintRefreshQueue.cs | 2 +- .../Handler/InlayHint/InlayHintResolveData.cs | 2 +- .../InlayHint/InlayHintResolveHandler.cs | 4 +- .../InlineCompletionsHandler.cs | 2 +- .../OnAutoInsert/OnAutoInsertHandler.cs | 2 +- .../GetTextDocumentWithContextHandler.cs | 2 +- .../PullHandlers/PreviousPullResult.cs | 2 +- .../References/FindAllReferencesHandler.cs | 4 +- .../References/FindImplementationsHandler.cs | 2 +- .../References/FindUsagesLSPContext.cs | 8 +- .../ILspReferencesResultCreationService.cs | 6 +- .../Protocol/Handler/Rename/RenameHandler.cs | 4 +- .../Protocol/Handler/RequestContext.cs | 2 +- .../Protocol/Handler/RequestContextFactory.cs | 2 +- .../SemanticTokens/SemanticTokensHelpers.cs | 4 +- .../SemanticTokensRangeHandler.cs | 4 +- .../SemanticTokensRefreshQueue.cs | 2 +- .../SemanticTokens/SemanticTokensSchema.cs | 2 +- .../Handler/SemanticTokens/TokenModifiers.cs | 2 +- .../ServerLifetime/InitializeHandler.cs | 2 +- .../ServerLifetime/InitializedHandler.cs | 2 +- .../LspServiceLifeCycleManager.cs | 2 +- .../SignatureHelp/SignatureHelpHandler.cs | 4 +- .../AbstractSpellCheckingHandler.cs | 2 +- .../SpellCheck/DocumentSpellCheckHandler.cs | 2 +- .../SpellCheck/WorkspaceSpellCheckHandler.cs | 2 +- .../Handler/Symbols/DocumentSymbolsHandler.cs | 4 +- .../ILspSymbolInformationCreationService.cs | 4 +- .../Handler/Symbols/RoslynDocumentSymbol.cs | 2 +- .../Symbols/RoslynDocumentSymbolParams.cs | 2 +- .../Symbols/WorkspaceSymbolsHandler.cs | 2 +- .../ExecuteWorkspaceCommandHandler.cs | 2 +- .../Protocol/ICapabilitiesProvider.cs | 2 +- .../Protocol/IClientCapabilitiesProvider.cs | 2 +- .../LanguageServer/Protocol/IOnInitialize.cs | 2 +- ...odeAnalysis.LanguageServer.Protocol.csproj | 3 - .../Protocol/RoslynLanguageServer.cs | 2 +- .../Protocol/Workspaces/ILspWorkspace.cs | 2 +- .../Workspaces/LspWorkspaceManager.cs | 2 +- .../CodeActions/CodeActionResolveTests.cs | 4 +- .../CodeActions/CodeActionsTests.cs | 4 +- .../CodeActions/RunCodeActionsTests.cs | 2 +- .../CodeLens/AbstractCodeLensTests.cs | 2 +- .../CodeLens/CSharpCodeLensTests.cs | 2 +- .../CodeLens/VisualBasicCodeLensTests.cs | 2 +- .../Completion/CompletionFeaturesTests.cs | 4 +- .../Completion/CompletionResolveTests.cs | 7 +- .../Completion/CompletionTests.cs | 4 +- ...ngeConfigurationNotificationHandlerTest.cs | 2 +- .../Definitions/GoToDefinitionTests.cs | 2 +- .../Definitions/GoToTypeDefinitionTests.cs | 2 +- .../AbstractPullDiagnosticTestsBase.cs | 4 +- .../AdditionalFileDiagnosticsTests.cs | 2 +- .../Diagnostics/PullDiagnosticTests.cs | 4 +- .../WorkspaceProjectDiagnosticsTests.cs | 2 +- .../DocumentChangesTests.LinkedDocuments.cs | 2 +- ...umentChangesTests.WithFindAllReferences.cs | 2 +- .../DocumentChanges/DocumentChangesTests.cs | 4 +- .../FoldingRanges/FoldingRangesTests.cs | 2 +- .../Formatting/FormatDocumentOnTypeTests.cs | 2 +- .../Formatting/FormatDocumentRangeTests.cs | 2 +- .../Formatting/FormatDocumentTests.cs | 2 +- .../Highlights/DocumentHighlightTests.cs | 2 +- .../ProtocolUnitTests/Hover/HoverTests.cs | 2 +- .../InlayHint/AbstractInlayHintTests.cs | 2 +- .../InlayHint/CSharpInlayHintTests.cs | 4 +- .../InlayHint/VisualBasicInlayHintTests.cs | 4 +- .../InlineCompletionsTests.cs | 2 +- .../LanguageServerTargetTests.cs | 2 +- .../LspMiscellaneousFilesWorkspaceTests.cs | 2 +- .../OnAutoInsert/OnAutoInsertTests.cs | 4 +- .../Ordering/FailingMutatingRequestHandler.cs | 2 +- .../Ordering/FailingRequestHandler.cs | 2 +- .../LongRunningNonMutatingRequestHandler.cs | 2 +- .../Ordering/MutatingRequestHandler.cs | 2 +- .../NonLSPSolutionRequestHandlerProvider.cs | 2 +- .../Ordering/NonMutatingRequestHandler.cs | 2 +- .../Ordering/RequestOrderingTests.cs | 4 +- .../GetTextDocumentWithContextHandlerTests.cs | 2 +- .../ProtocolConversionsTests.cs | 4 +- .../FindAllReferencesHandlerFeaturesTests.cs | 2 +- .../FindAllReferencesHandlerTests.cs | 5 +- .../References/FindImplementationsTests.cs | 2 +- .../ProtocolUnitTests/Rename/RenameTests.cs | 4 +- .../AbstractSemanticTokensTests.cs | 4 +- .../SemanticTokensRangeTests.cs | 4 +- .../SignatureHelp/SignatureHelpTests.cs | 2 +- .../SpellCheck/SpellCheckTests.cs | 2 +- .../Symbols/DocumentSymbolsTests.cs | 2 +- .../Symbols/WorkspaceSymbolsTests.cs | 2 +- .../ProtocolUnitTests/UriTests.cs | 2 +- .../VSTypeScriptHandlerTests.cs | 2 +- .../ValidateBreakableRangeTests.cs | 2 +- .../Workspaces/LspWorkspaceManagerTests.cs | 2 +- src/Features/Lsif/Generator/Generator.cs | 6 +- .../Generator/Graph/FoldingRangeResult.cs | 2 +- .../Lsif/Generator/Graph/HoverResult.cs | 2 +- src/Features/Lsif/Generator/Graph/Range.cs | 2 +- .../Generator/Graph/SemanticTokensResult.cs | 2 +- .../IResultSetTrackerExtensions.cs | 2 +- .../Lsif/GeneratorTest/FoldingRangeTests.vb | 2 +- src/Features/Lsif/GeneratorTest/HoverTests.vb | 2 +- .../Lsif/GeneratorTest/RangeResultSetTests.vb | 3 +- .../GeneratorTest/Utilities/TestLsifOutput.vb | 8 +- .../Extensions/ProtocolConversions.cs | 4 +- ...operSdkLspServiceDocumentRequestHandler.cs | 2 +- .../IFSharpWorkspaceProjectContextFactory.cs | 3 - .../Razor/IRazorCapabilitiesProvider.cs | 2 +- .../RazorLanguageServerFactoryWrapper.cs | 8 +- .../Razor/RazorSemanticTokensAccessor.cs | 2 +- .../Lsp/LspCompletionBenchmarks.cs | 2 +- .../LspCompletionSerializationBenchmarks.cs | 11 +- .../DocumentOutlineTestsBase.cs | 4 +- ...tlineViewModel.DocumentOutlineViewState.cs | 1 - ...ntOutlineViewModel.IntervalIntrospector.cs | 2 - .../DocumentOutlineViewModel.cs | 11 +- .../DocumentOutlineViewModel_Utilities.cs | 4 +- .../Def/DocumentOutline/DocumentSymbolData.cs | 2 +- .../DocumentSymbolDataViewModel.cs | 2 - .../Core/Def/DocumentOutline/SortOption.cs | 2 +- .../Client/RemoteLanguageServiceWorkspace.cs | 4 +- .../CustomProtocol/LspRequestExtensions.cs | 4 +- ...lyn.VisualStudio.Setup.Dependencies.csproj | 4 - .../LanguageClient/XamlCapabilities.cs | 2 +- .../XamlInProcLanguageClient.cs | 2 +- .../XamlInProcLanguageClientDisableUX.cs | 2 +- .../CodeActions/CodeActionsHandlerProvider.cs | 2 +- .../Commands/CreateEventCommandHandler.cs | 2 +- .../Handler/Completion/CompletionHandler.cs | 7 +- .../Completion/CompletionResolveData.cs | 2 +- .../Completion/CompletionResolveHandler.cs | 11 +- .../Definitions/GoToDefinitionHandler.cs | 4 +- .../AbstractPullDiagnosticHandler.cs | 4 +- .../DocumentPullDiagnosticHandler.cs | 2 +- .../WorkspacePullDiagnosticHandler.cs | 2 +- .../FoldingRanges/FoldingRangesHandler.cs | 2 +- .../AbstractFormatDocumentHandlerBase.cs | 4 +- .../Formatting/FormatDocumentHandler.cs | 2 +- .../Formatting/FormatDocumentOnTypeHandler.cs | 2 +- .../Formatting/FormatDocumentRangeHandler.cs | 2 +- .../Handler/Hover/HoverHandler.cs | 2 +- .../OnAutoInsert/OnAutoInsertHandler.cs | 2 +- .../OnTypeRename/OnTypeRenameHandler.cs | 2 +- .../XamlRequestExecutionQueue.cs | 2 +- 585 files changed, 19521 insertions(+), 353 deletions(-) create mode 100644 src/EditorFeatures/Core/Extensions/LSPExtensions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/.editorconfig create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.Designer.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.resx create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditResponse.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeAction.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKindSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionLiteralSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionResolveSupportSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionTriggerKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeDescription.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLens.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensWorkspaceSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Color.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ColorInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Command.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKindSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemLabelDetails.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTag.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTagSupportSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionList.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionTriggerKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/DocumentUriConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/JsonConverterCollectionUtilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/KindAttribute.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/ParameterInformationConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/StringEnumConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/SumConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/TextDocumentSyncConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFile.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFileOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CustomDictionary.xml create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefaultBehaviorPrepareRename.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefinitionOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFile.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFileOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Diagnostic.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRelatedInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticServerCancellationData.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSeverity.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticTag.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticWorkspaceSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeConfigurationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeTextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeWatchedFilesParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidCloseTextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidOpenTextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidSaveTextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportPartialResult.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFilter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlight.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLink.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbol.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DynamicRegistrationSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionUtilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnostic.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticProjectInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticRank.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticTags.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSGetProjectContextsParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSImageId.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSLocation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSMethods.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContextList.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSServerCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSSymbolInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSTextDocumentIdentifier.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileChangeType.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileEvent.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRange.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSettingOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FormattingOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FullDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Hover.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IPartialResultParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStaticRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStringEnum.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ISumType.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentPositionParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IWorkDoneProgressOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ImplementationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeError.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeErrorCode.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeResult.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializedParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintLabelPart.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintResolveSupportSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintWorkspaceSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceEdit.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceRange.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextFormat.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextMode.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextModeSupportSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ContainerElementConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/DropProgressConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageElementConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageIdConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ObjectContentConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/RegexConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextElement.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRun.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRunStyle.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElement.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElementStyle.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageElement.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageId.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSFoldingRangeSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClipboardContent.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeAction.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroup.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroupSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCommitCharacter.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionInvokeKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionList.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionListSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterClass.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterRange.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterSingle.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalHover.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalIconMapping.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionList.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionRequest.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalItemOrigin.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKindAndModifier.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKindModifiers.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKinds.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalLocation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMethods.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMultipleContextFeatures.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalPriorityLevel.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalProjectContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSelection.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSupport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameRange.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalResolutionStatusKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSelectedCompletionInfo.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalServerCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSignatureInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSnippetSupportLevel.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalStreamingParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSymbolInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextPresentationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalUriPresentationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.csproj create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.ruleset create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRanges.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Location.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LogMessageParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspNotification.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspRequest.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkedString.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupContent.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MaybeNullWhenAttribute.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageActionItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageType.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Methods.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/OptionalVersionedTextDocumentIdentifier.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformationSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Position.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareRenameParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareSupportDefaultBehavior.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PreviousResultId.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticsSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Range.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Registration.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RegistrationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedFullDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedUnchangedDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFile.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFileOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameRange.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResolveSupportSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResourceOperationKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SaveOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenFormat.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenModifiers.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenTypes.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokens.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDelta.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaPartialResult.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensEdit.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensFullOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensLegend.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensPartialResult.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRangeParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsFullSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensWorkspaceSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ServerCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageRequestParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelp.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpContext.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpTriggerKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformationSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SumType.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolInformation.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKindSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SynchronizationSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TagSupport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentContentChangeEvent.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentEdit.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentIdentifier.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentItem.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentPositionParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentRegistrationOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSaveReason.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncKind.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextEdit.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TraceSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TypeDefinitionOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnchangedDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Unregistration.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnregistrationParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/VersionedTextDocumentIdentifier.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WillSaveTextDocumentParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceClientCapabilities.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReportPartialResult.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEdit.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEditSetting.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceFullDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolOptions.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolParams.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceUnchangedDocumentDiagnosticReport.cs create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.cs.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.de.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.es.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.fr.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.it.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ja.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ko.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pl.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pt-BR.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ru.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.tr.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hans.xlf create mode 100644 src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hant.xlf diff --git a/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs b/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs index 644ed8bf12a50..fcbf1c8655e83 100644 --- a/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs +++ b/src/EditorFeatures/Core/Classification/Syntactic/SyntacticClassificationTaggerProvider.TagComputer.cs @@ -4,25 +4,20 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.Collections; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Shared.Tagging; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Tagging; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Classification diff --git a/src/EditorFeatures/Core/Extensions/LSPExtensions.cs b/src/EditorFeatures/Core/Extensions/LSPExtensions.cs new file mode 100644 index 0000000000000..48bd9dc4a8d1d --- /dev/null +++ b/src/EditorFeatures/Core/Extensions/LSPExtensions.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.Extensions +{ + internal static class LSPExtensions + { + public static Roslyn.Core.Imaging.ImageId ToLSPImageId(this VisualStudio.Core.Imaging.ImageId imageId) + => new Roslyn.Core.Imaging.ImageId(imageId.Guid, imageId.Id); + + public static Roslyn.Text.Adornments.ImageElement ToLSPImageElement(this VisualStudio.Text.Adornments.ImageElement imageElement) + => new Roslyn.Text.Adornments.ImageElement(imageElement.ImageId.ToLSPImageId(), imageElement.AutomationName); + + public static Roslyn.Text.Adornments.ClassifiedTextRun ToLSPRun(this VisualStudio.Text.Adornments.ClassifiedTextRun run) + => new Roslyn.Text.Adornments.ClassifiedTextRun(run.ClassificationTypeName, run.Text, run.NavigationAction, run.Tooltip, (Roslyn.Text.Adornments.ClassifiedTextRunStyle)run.Style); + + public static Roslyn.Text.Adornments.ClassifiedTextElement ToLSPElement(this VisualStudio.Text.Adornments.ClassifiedTextElement element) + => new Roslyn.Text.Adornments.ClassifiedTextElement(element.Runs.Select(r => r.ToLSPRun())); + } +} diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs index f2df904d91bce..bb128f92430dd 100644 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs +++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstractVSTypeScriptRequestHandler.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs index a563d7bb42ade..f3f046f811b1b 100644 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs +++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptCapabilitiesProvider.cs @@ -2,9 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; + internal interface IVSTypeScriptCapabilitiesProvider { /// diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs index ce79c70c3b560..bdcec5aa925c9 100644 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs @@ -13,12 +13,11 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Utilities; using Newtonsoft.Json; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index 7a2e568f75861..a47979514821c 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -17,9 +17,9 @@ using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Threading; using Nerdbank.Streams; +using Roslyn.LanguageServer.Protocol; using StreamJsonRpc; namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient diff --git a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs index f2cf2461aad62..ecd9c54712281 100644 --- a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.Composition; @@ -15,11 +14,10 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Utilities; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient { diff --git a/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs index c649c41643e19..8b5f4c1242177 100644 --- a/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs +++ b/src/EditorFeatures/Core/LanguageServer/EditorHoverCreationService.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.QuickInfo; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs index 24dcd042d685e..e79d0c7744cdb 100644 --- a/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs +++ b/src/EditorFeatures/Core/LanguageServer/EditorLspCompletionResultCreationService.cs @@ -9,13 +9,14 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text.Adornments; +using Roslyn.Text.Adornments; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { @@ -42,7 +43,7 @@ public EditorLspCompletionResultCreationService() var lspItem = new LSP.VSInternalCompletionItem { Label = item.GetEntireDisplayText(), - Icon = new ImageElement(item.Tags.GetFirstGlyph().GetImageId()) + Icon = new ImageElement(item.Tags.GetFirstGlyph().GetImageId().ToLSPImageId()), }; // Complex text edits (e.g. override and partial method completions) are always populated in the diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs index cd39902d5abc6..4931a55761710 100644 --- a/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs +++ b/src/EditorFeatures/Core/LanguageServer/EditorLspReferencesResultCreationService.cs @@ -6,12 +6,13 @@ using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.FindSymbols.Finders; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text.Adornments; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using Roslyn.Text.Adornments; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { @@ -24,7 +25,7 @@ public EditorLspReferencesResultCreationService() { } - public SumType? CreateReference( + public SumType? CreateReference( int definitionId, int id, ClassifiedTextElement text, @@ -33,15 +34,16 @@ public EditorLspReferencesResultCreationService() ClassifiedTextElement? definitionText, Glyph definitionGlyph, SymbolUsageInfo? symbolUsageInfo, - VisualStudio.LanguageServer.Protocol.Location? location) + Roslyn.LanguageServer.Protocol.Location? location) { // TO-DO: The Origin property should be added once Rich-Nav is completed. // https://github.com/dotnet/roslyn/issues/42847 + var imageId = definitionGlyph.GetImageId(); var result = new VSInternalReferenceItem { DefinitionId = definitionId, DefinitionText = definitionText, // Only definitions should have a non-null DefinitionText - DefinitionIcon = new ImageElement(definitionGlyph.GetImageId()), + DefinitionIcon = new ImageElement(imageId.ToLSPImageId()), DisplayPath = location?.Uri.LocalPath, Id = id, Kind = symbolUsageInfo.HasValue ? ProtocolConversions.SymbolUsageInfoToReferenceKinds(symbolUsageInfo.Value) : Array.Empty(), diff --git a/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs b/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs index de4a1a09930a1..2359a42ccc472 100644 --- a/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs +++ b/src/EditorFeatures/Core/LanguageServer/EditorLspSymbolInformationCreationService.cs @@ -7,8 +7,8 @@ using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { diff --git a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs index 4eb4e78b76e79..4e23590c9dbaa 100644 --- a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs @@ -9,13 +9,11 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; -using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Utilities; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient { diff --git a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs index 6c091cbf551ba..e171ed53ceea9 100644 --- a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs @@ -11,11 +11,10 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler.InlineCompletions; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Utilities; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient { diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs index 4d7fdf68bffbd..378cca668dc0b 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs @@ -5,7 +5,7 @@ using System; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.Options; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Roslyn.Test.Utilities { diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 728205e782d45..812f88ee0e129 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.Editor.Test; using Microsoft.CodeAnalysis.Editor.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; @@ -37,7 +38,7 @@ using StreamJsonRpc; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Roslyn.Test.Utilities { @@ -120,10 +121,9 @@ protected static LSP.ClientCapabilities GetCapabilities(bool isVS) /// /// Asserts two objects are equivalent by converting to JSON and ignoring whitespace. /// - /// the JSON object type. /// the expected object to be converted to JSON. /// the actual object to be converted to JSON. - public static void AssertJsonEquals(T expected, T actual) + public static void AssertJsonEquals(T1 expected, T2 actual) { var expectedStr = JsonConvert.SerializeObject(expected); var actualStr = JsonConvert.SerializeObject(actual); @@ -280,7 +280,7 @@ protected static LSP.CompletionParams CreateCompletionParams( }; if (tags != null) - item.Icon = tags.ToImmutableArray().GetFirstGlyph().GetImageElement(); + item.Icon = tags.ToImmutableArray().GetFirstGlyph().GetImageElement().ToLSPImageElement(); if (commitCharacters != null) item.CommitCharacters = commitCharacters.Value.Select(c => c.ToString()).ToArray(); diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs index ea8dc39c00e83..8c6d5c693539c 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerConnectHandler.cs @@ -2,17 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; using System.Composition; -using System.Linq; using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; namespace Microsoft.CodeAnalysis.LanguageServer.BrokeredServices; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs index 1b8b495b941ef..cc21693eb3c6e 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/ServerCapabilitiesProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.LanguageServer; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs index 9fa2db348e9bb..a13a2965ecfda 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/CapabilitiesManager.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CommonLanguageServerProtocol.Framework.Example; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs index 6b52478246d36..5c2fc79a0c3b4 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/ExampleLanguageServer.cs @@ -5,7 +5,7 @@ using System; using Microsoft.CommonLanguageServerProtocol.Framework.Handlers; using Microsoft.Extensions.DependencyInjection; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using StreamJsonRpc; namespace Microsoft.CommonLanguageServerProtocol.Framework.Example; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj index 611886a1afede..3a71b4d5bb772 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/Microsoft.CommonLanguageServerProtocol.Framework.Example.csproj @@ -11,7 +11,6 @@ - diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs index 3cfcaf701705d..21f96bf48f653 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.Example/MultiRegisteringHandler.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CommonLanguageServerProtocol.Framework.Example; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs index 9fc80b18c4c62..844c1de5cd591 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/ExampleTests.cs @@ -4,7 +4,7 @@ using System; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit; namespace Microsoft.CommonLanguageServerProtocol.Framework.UnitTests; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs index 00812d946b36f..aad9f122d7f9f 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework.UnitTests/TestExampleLanguageServer.cs @@ -7,11 +7,10 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CommonLanguageServerProtocol.Framework.Example; -using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.Extensions.DependencyInjection; using Nerdbank.Streams; +using Roslyn.LanguageServer.Protocol; using StreamJsonRpc; -using Microsoft.Extensions.DependencyInjection; namespace Microsoft.CommonLanguageServerProtocol.Framework.UnitTests; diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/.editorconfig b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/.editorconfig new file mode 100644 index 0000000000000..1d40f254550c9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. +dotnet_diagnostic.CS8618.severity = none diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.Designer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.Designer.cs new file mode 100644 index 0000000000000..3791023194914 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.Designer.cs @@ -0,0 +1,126 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.CommonLanguageServerProtocol.Framework { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class LSPFrameworkResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal LSPFrameworkResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CommonLanguageServerProtocol.Framework.LSPFrameworkResources", typeof(LSPFrameworkResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Unable to deserialize Uri. Unexpected value encountered: {0}. + /// + internal static string DocumentUriSerializationError { + get { + return ResourceManager.GetString("DocumentUriSerializationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to deserialize MarkupContent. Unexpected value encountered: {0}. + /// + internal static string MarkupContentSerializationError { + get { + return ResourceManager.GetString("MarkupContentSerializationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A SumType cannot have another SumType as type parameter.. + /// + internal static string NestedSumType { + get { + return ResourceManager.GetString("NestedSumType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to None of the SumType type parameters could be deserialized. + /// + internal static string NoSumTypeMatch { + get { + return ResourceManager.GetString("NoSumTypeMatch", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type {0} is missing a contructor that takes a single string as parameter.. + /// + internal static string StringEnumMissingConstructor { + get { + return ResourceManager.GetString("StringEnumMissingConstructor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to deserialize string-based enum. Unexpected data encountered: {0}. + /// + internal static string StringEnumSerializationError { + get { + return ResourceManager.GetString("StringEnumSerializationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0}. + /// + internal static string TextDocumentSyncSerializationError { + get { + return ResourceManager.GetString("TextDocumentSyncSerializationError", resourceCulture); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.resx b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.resx new file mode 100644 index 0000000000000..7dc4d9c00c182 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/LSPFrameworkResources.resx @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Unable to deserialize Uri. Unexpected value encountered: {0} + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + A SumType cannot have another SumType as type parameter. + + + None of the SumType type parameters could be deserialized + + + Type {0} is missing a contructor that takes a single string as parameter. + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj index b8cdd1405d711..17f541c7a3cfa 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj @@ -12,6 +12,7 @@ License.txt + @@ -25,4 +26,17 @@ + + + True + True + LSPFrameworkResources.resx + + + + + ResXFileCodeGenerator + LSPFrameworkResources.Designer.cs + + diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditParams.cs new file mode 100644 index 0000000000000..853ad52afa59f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditParams.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent from a server to a client for the workspace/applyEdit request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ApplyWorkspaceEditParams + { + /// + /// Gets or sets the label associated with this edit. + /// + [DataMember(Name = "label")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Label + { + get; + set; + } + + /// + /// Gets or sets the edit to be applied to the workspace. + /// + [DataMember(Name = "edit")] + public WorkspaceEdit Edit + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditResponse.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditResponse.cs new file mode 100644 index 0000000000000..73cb6d450154b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ApplyWorkspaceEditResponse.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the response sent for a workspace/applyEdit request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ApplyWorkspaceEditResponse + { + /// + /// Gets or sets a value indicating whether edits were applied or not. + /// + [DataMember(Name = "applied")] + public bool Applied + { + get; + set; + } + + /// + /// Gets or sets a string with textual description for why the edit was not applied. + /// + [DataMember(Name = "failureReason")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? FailureReason + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ClientCapabilities.cs new file mode 100644 index 0000000000000..c4aaf85340fa0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ClientCapabilities.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents client capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ClientCapabilities + { + /// + /// Gets or sets the workspace capabilities. + /// + [DataMember(Name = "workspace")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public WorkspaceClientCapabilities? Workspace + { + get; + set; + } + + /// + /// Gets or sets the text document capabilities. + /// + [DataMember(Name = "textDocument")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public TextDocumentClientCapabilities? TextDocument + { + get; + set; + } + + /// + /// Gets or sets the experimental capabilities. + /// + [DataMember(Name = "experimental")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Experimental + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeAction.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeAction.cs new file mode 100644 index 0000000000000..d805e8e472252 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeAction.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A class representing a change that can be performed in code. A CodeAction must either set + /// or . If both are supplied, + /// the edit will be applied first, then the command will be executed. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeAction + { + /// + /// Gets or sets the human readable title for this code action. + /// + [DataMember(Name = "title")] + public string Title + { + get; + set; + } + + /// + /// Gets or sets the kind of code action this instance represents. + /// + [DataMember(Name = "kind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionKind? Kind + { + get; + set; + } + + /// + /// Gets or sets the diagnostics that this code action resolves. + /// + [DataMember(Name = "diagnostics")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Diagnostic[]? Diagnostics + { + get; + set; + } + + /// + /// Gets or sets the workspace edit that this code action performs. + /// + [DataMember(Name = "edit")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public WorkspaceEdit? Edit + { + get; + set; + } + + /// + /// Gets or sets the command that this code action executes. + /// + [DataMember(Name = "command")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Command? Command + { + get; + set; + } + + /// + /// Gets or sets the data that will be resend to the server if the code action is selected to be resolved. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionContext.cs new file mode 100644 index 0000000000000..a05e8c5fa0cde --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionContext.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing diagnostic information about the context of a code action + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionContext + { + /// + /// Gets or sets an array of diagnostics relevant to a code action. + /// + [DataMember(Name = "diagnostics")] + public Diagnostic[] Diagnostics + { + get; + set; + } + + /// + /// Gets or sets an array of code action kinds to filter for. + /// + [DataMember(Name = "only")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionKind[]? Only + { + get; + set; + } + + /// + /// Gets or sets the indicating how the code action was triggered.. + /// + [DataMember(Name = "triggerKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionTriggerKind? TriggerKind + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKind.cs new file mode 100644 index 0000000000000..2faa437dd1791 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKind.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Value representing the kind of a code action. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct CodeActionKind(string Value) : IStringEnum + { + /// + /// Empty kind. + /// + public static readonly CodeActionKind Empty = new(string.Empty); + + /// + /// Code action is a refactor. + /// + public static readonly CodeActionKind QuickFix = new("quickfix"); + + /// + /// Base kind for refactoring actions. + /// + public static readonly CodeActionKind Refactor = new("refactor"); + + /// + /// Base kind for refactoring extraction actions, like extracting methods, functions, + /// variables, etc. + /// + public static readonly CodeActionKind RefactorExtract = new("refactor.extract"); + + /// + /// Base kind for refactoring inline actions, like inlining functions, variables, + /// constants, etc. + /// + public static readonly CodeActionKind RefactorInline = new("refactor.inline"); + + /// + /// Base kind for refactoring rewrite actions, like adding or removing a parameter, + /// making a method static, etc. + /// + public static readonly CodeActionKind RefactorRewrite = new("refactor.rewrite"); + + /// + /// Base kind for source actions, which apply to the entire file. + /// + public static readonly CodeActionKind Source = new("source"); + + /// + /// Base kind for an organize imports source action. + /// + public static readonly CodeActionKind SourceOrganizeImports = new("source.organizeImports"); + + /// + /// Base kind for a fix all source action, which automatically fixes errors that have a clear + /// fix that do not require user input. + /// + /// + /// They should not suppress errors or perform unsafe fixes such as generating new + /// types or classes. + /// + public static readonly CodeActionKind SourceFixAll = new("source.fixAll"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKindSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKindSetting.cs new file mode 100644 index 0000000000000..86c73a7ac1156 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionKindSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class containing the set of code action kinds that are supported. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionKindSetting + { + /// + /// Gets or sets the code actions kinds the client supports. + /// + [DataMember(Name = "valueSet")] + public CodeActionKind[] ValueSet + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionLiteralSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionLiteralSetting.cs new file mode 100644 index 0000000000000..e852ada889a88 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionLiteralSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing support for code action literals. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionLiteralSetting + { + /// + /// Gets or sets a value indicating what code action kinds are supported. + /// + [DataMember(Name = "codeActionKind")] + public CodeActionKindSetting CodeActionKind + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionOptions.cs new file mode 100644 index 0000000000000..8fe9145557ad5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionOptions.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the registration options for code actions support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets the kinds of code action that this server may return. + /// + /// + /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + /// may list out every specific kind they provide. + /// + [DataMember(Name = "codeActionKinds")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionKind[]? CodeActionKinds + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support to resolve + /// additional information for a code action. + /// + [DataMember(Name = "resolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ResolveProvider + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionParams.cs new file mode 100644 index 0000000000000..910038de2836e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionParams.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent from the client to the server for the textDocument/codeAction request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionParams : ITextDocumentParams + { + /// + /// Gets or sets the document identifier indicating where the command was invoked. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the range in the document for which the command was invoked. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the additional diagnostic information about the code action context. + /// + [DataMember(Name = "context")] + public CodeActionContext Context + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionResolveSupportSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionResolveSupportSetting.cs new file mode 100644 index 0000000000000..e214041b74bf9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionResolveSupportSetting.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing settings for codeAction/resolve support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionResolveSupportSetting + { + /// + /// Gets or sets a value indicating the properties that a client can resolve lazily. + /// + [DataMember(Name = "properties")] + public string[] Properties + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionSetting.cs new file mode 100644 index 0000000000000..fc967728c0e28 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionSetting.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing settings for code action support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeActionSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating the client supports code action literals. + /// + [DataMember(Name = "codeActionLiteralSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionLiteralSetting? CodeActionLiteralSupport + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client supports resolving + /// additional code action properties via a separate `codeAction/resolve` + /// request. + /// + [DataMember(Name = "resolveSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionResolveSupportSetting? ResolveSupport + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether code action supports the `data` + /// property which is preserved between a `textDocument/codeAction` and a + /// `codeAction/resolve` request. + /// + [DataMember(Name = "dataSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DataSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionTriggerKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionTriggerKind.cs new file mode 100644 index 0000000000000..e799e11aa032f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeActionTriggerKind.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum which represents the various reason why code actions were requested. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum CodeActionTriggerKind + { + /// + /// Code actions were explicitly requested by the user or by an extension. + /// + Invoked = 1, + + /// + /// Code actions were requested automatically. + /// This typically happens when current selection in a file changes, but can also be triggered when file content changes. + /// + Automatic = 2, + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeDescription.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeDescription.cs new file mode 100644 index 0000000000000..abe5c02a4eda3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeDescription.cs @@ -0,0 +1,76 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a description for an error code. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeDescription : IEquatable + { + /// + /// Gets or sets URI to open with more information about the diagnostic error. + /// + [DataMember(Name = "href")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Href + { + get; + set; + } + + public static bool operator ==(CodeDescription? value1, CodeDescription? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(CodeDescription? value1, CodeDescription? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(CodeDescription other) + { + return other is not null + && this.Href == other.Href; + } + + /// + public override bool Equals(object obj) + { + if (obj is CodeDescription other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return this.Href == null ? 53 : this.Href.GetHashCode(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLens.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLens.cs new file mode 100644 index 0000000000000..cba341fab4478 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLens.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A class representing a code lens command that should be shown alongside source code. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeLens + { + /// + /// Gets or sets the range that the code lens applies to. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the command associated with this code lens. + /// + [DataMember(Name = "command")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Command? Command + { + get; + set; + } + + /// + /// Gets or sets the data that should be preserved between a textDocument/codeLens request and a codeLens/resolve request. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensOptions.cs new file mode 100644 index 0000000000000..46c4e59a606aa --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for code lens support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeLensOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether or not the code lens support has a resolve provider. + /// + [DataMember(Name = "resolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ResolveProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensParams.cs new file mode 100644 index 0000000000000..1063efdcc9c5d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent from the client to the server for a textDocument/codeLens request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeLensParams : ITextDocumentParams + { + /// + /// Gets or sets the document identifier to fetch code lens results for. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensWorkspaceSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensWorkspaceSetting.cs new file mode 100644 index 0000000000000..4135f4e34c995 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CodeLensWorkspaceSetting.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Newtonsoft.Json; +using System.Runtime.Serialization; + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class representing the workspace code lens client capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CodeLensWorkspaceSetting + { + /// + /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client. + /// + [DataMember(Name = "refreshSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RefreshSupport { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Color.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Color.cs new file mode 100644 index 0000000000000..27b257f596a56 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Color.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents a color. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Color + { + /// + /// Gets or sets the Red value. + /// + /// + /// Value should be clamped to [0,1]. + /// + [DataMember(Name = "red")] + public decimal Red { get; set; } + + /// + /// Gets or sets the Green value. + /// + /// + /// Value should be clamped to [0,1]. + /// + [DataMember(Name = "green")] + public decimal Green { get; set; } + + /// + /// Gets or sets the Blue value. + /// + /// + /// Value should be clamped to [0,1]. + /// + [DataMember(Name = "blue")] + public decimal Blue { get; set; } + + /// + /// Gets or sets the Alpha value. + /// + /// + /// Value should be clamped to [0,1]. + /// + [DataMember(Name = "alpha")] + public decimal Alpha { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ColorInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ColorInformation.cs new file mode 100644 index 0000000000000..a279bc0ea554a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ColorInformation.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents color information. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ColorInformation + { + /// + /// Gets or sets the text range representing the color. + /// + [DataMember(Name = "range")] + public Range Range { get; set; } + + /// + /// Gets or sets the color. + /// + [DataMember(Name = "color")] + public Color Color { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Command.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Command.cs new file mode 100644 index 0000000000000..77310d34c07cc --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Command.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a reference to a command + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Command + { + /// + /// Gets or sets the title of the command. + /// + [DataMember(Name = "title")] + [JsonProperty(Required = Required.Always)] + public string Title + { + get; + set; + } + + /// + /// Gets or sets the identifier associated with the command. + /// + [DataMember(Name = "command")] + [JsonProperty(Required = Required.Always)] + public string CommandIdentifier + { + get; + set; + } + + /// + /// Gets or sets the arguments that the command should be invoked with. + /// + [DataMember(Name = "arguments")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object[]? Arguments + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionContext.cs new file mode 100644 index 0000000000000..e375d523ac33e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionContext.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing additional information about the content in which a completion request is triggered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionContext + { + /// + /// Gets or sets the indicating how the completion was triggered. + /// + [DataMember(Name = "triggerKind")] + public CompletionTriggerKind TriggerKind + { + get; + set; + } + + /// + /// Gets or sets the character that triggered code completion. + /// + [DataMember(Name = "triggerCharacter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? TriggerCharacter + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItem.cs new file mode 100644 index 0000000000000..86fa6014d3d97 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItem.cs @@ -0,0 +1,209 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents an IntelliSense completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItem + { + /// + /// Gets or sets the label value, i.e. display text to users. + /// + [DataMember(Name = "label", IsRequired = true)] + public string Label + { + get; + set; + } + + /// + /// Gets or sets additional details for the label. + /// + [DataMember(Name = "labelDetails")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemLabelDetails? LabelDetails + { + get; + set; + } + + /// + /// Gets or sets the completion kind. + /// + [DataMember(Name = "kind")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + [DefaultValue(CompletionItemKind.None)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public CompletionItemKind Kind + { + get; + set; + } = CompletionItemKind.None; + + /// + /// Gets or sets the completion detail. + /// + [DataMember(Name = "detail")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Detail + { + get; + set; + } + + /// + /// Gets or sets the documentation comment. + /// + [DataMember(Name = "documentation")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public SumType? Documentation + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether this should be the selected item when showing. + /// + [DataMember(Name = "preselect")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Preselect + { + get; + set; + } + + /// + /// Gets or sets the custom sort text. + /// + [DataMember(Name = "sortText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? SortText + { + get; + set; + } + + /// + /// Gets or sets the custom filter text. + /// + [DataMember(Name = "filterText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? FilterText + { + get; + set; + } + + /// + /// Gets or sets the insert text. + /// + [DataMember(Name = "insertText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? InsertText + { + get; + set; + } + + /// + /// Gets or sets the insert text format. + /// + [DataMember(Name = "insertTextFormat")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + [DefaultValue(InsertTextFormat.Plaintext)] + public InsertTextFormat InsertTextFormat + { + get; + set; + } = InsertTextFormat.Plaintext; + + /// + /// Gets or sets the text edit. + /// + [DataMember(Name = "textEdit")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? TextEdit + { + get; + set; + } + + /// + /// Gets or sets the text edit text. + /// + [DataMember(Name = "textEditText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? TextEditText + { + get; + set; + } + + /// + /// Gets or sets any additional text edits. + /// + /// + /// Additional text edits must not interfere with the main text edit. + /// + [DataMember(Name = "additionalTextEdits")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public TextEdit[]? AdditionalTextEdits + { + get; + set; + } + + /// + /// Gets or sets the set of characters that will commit completion when this is selected + /// If present, this will override . + /// If absent, will be used instead. + /// + [DataMember(Name = "commitCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? CommitCharacters + { + get; + set; + } + + /// + /// Gets or sets any optional command that will be executed after completion item insertion. + /// + /// + /// This feature is not supported in VS. + /// + [DataMember(Name = "command")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Command? Command + { + get; + set; + } + + /// + /// Gets or sets any additional data that links the unresolve completion item and the resolved completion item. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKind.cs new file mode 100644 index 0000000000000..d8bb4e6a5d1fe --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKind.cs @@ -0,0 +1,208 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum values for completion item kinds. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum CompletionItemKind + { + /// + /// Value to use when no kind was provided. + /// + None = 0, + + // LSP Spec v3.16: + + /// + /// Text. + /// + Text = 1, + + /// + /// Method. + /// + Method = 2, + + /// + /// Function. + /// + Function = 3, + + /// + /// Constructor. + /// + Constructor = 4, + + /// + /// Field. + /// + Field = 5, + + /// + /// Variable. + /// + Variable = 6, + + /// + /// Class. + /// + Class = 7, + + /// + /// Interface. + /// + Interface = 8, + + /// + /// Module. + /// + Module = 9, + + /// + /// Property. + /// + Property = 10, + + /// + /// Unit. + /// + Unit = 11, + + /// + /// Value. + /// + Value = 12, + + /// + /// Enum. + /// + Enum = 13, + + /// + /// Keyword. + /// + Keyword = 14, + + /// + /// Snippet. + /// + Snippet = 15, + + /// + /// Color. + /// + Color = 16, + + /// + /// File. + /// + File = 17, + + /// + /// Reference. + /// + Reference = 18, + + /// + /// Folder. + /// + Folder = 19, + + /// + /// EnumMember. + /// + EnumMember = 20, + + /// + /// Constant. + /// + Constant = 21, + + /// + /// Struct. + /// + Struct = 22, + + /// + /// Event. + /// + Event = 23, + + /// + /// Operator. + /// + Operator = 24, + + /// + /// TypeParameter. + /// + TypeParameter = 25, + + // Kinds custom to VS, starting with index 118115 to avoid collisions with other clients's custom kinds. + + /// + /// Macro. + /// + Macro = 118115 + 0, + + /// + /// Namespace. + /// + Namespace = 118115 + 1, + + /// + /// Template. + /// + Template = 118115 + 2, + + /// + /// TypeDefinition. + /// + TypeDefinition = 118115 + 3, + + /// + /// Union. + /// + Union = 118115 + 4, + + /// + /// Delegate. + /// + Delegate = 118115 + 5, + + /// + /// TagHelper. + /// + TagHelper = 118115 + 6, + + /// + /// ExtensionMethod. + /// + ExtensionMethod = 118115 + 7, + + /// + /// Element. + /// + Element = 118115 + 8, + + /// + /// LocalResource. + /// + LocalResource = 118115 + 9, + + /// + /// SystemResource. + /// + SystemResource = 118115 + 10, + + /// + /// CloseElement. + /// + CloseElement = 118115 + 11, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKindSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKindSetting.cs new file mode 100644 index 0000000000000..40b0ced040d6f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemKindSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the initialization setting for completion item kind + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItemKindSetting + { + /// + /// Gets or sets the values that the client supports. + /// + [DataMember(Name = "valueSet")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemKind[]? ValueSet + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemLabelDetails.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemLabelDetails.cs new file mode 100644 index 0000000000000..619d03b79c46c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemLabelDetails.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + using System.Runtime.Serialization; + + /// + /// Additional details for a completion item label. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItemLabelDetails + { + /// + /// Gets or sets an optional string which is rendered less prominently directly after label, without any spacing. + /// + [DataMember(Name = "detail")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Detail + { + get; + set; + } + + /// + /// Gets or sets an optional string which is rendered less prominently after detail. + /// + [DataMember(Name = "description")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Description + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemOptions.cs new file mode 100644 index 0000000000000..70d846f74f0b4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents completion item capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItemOptions + { + /// + /// Gets or sets a value indicating The server has support for completion item label details + /// + [DataMember(Name = "labelDetailsSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool LabelDetailsSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemSetting.cs new file mode 100644 index 0000000000000..67ac7799092f4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemSetting.cs @@ -0,0 +1,128 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents initialization setting for completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItemSetting + { + /// + /// Gets or sets a value indicating whether completion items can contain snippets. + /// + [DataMember(Name = "snippetSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SnippetSupport + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client supports commit characters. + /// + [DataMember(Name = "commitCharactersSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool CommitCharactersSupport + { + get; + set; + } + + /// + /// Gets or sets the content formats supported for documentation. + /// + [DataMember(Name = "documentationFormat")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public MarkupKind[]? DocumentationFormat + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports the deprecated property on a completion item. + /// + [DataMember(Name = "deprecatedSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DeprecatedSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports the preselect property on a completion item. + /// + [DataMember(Name = "preselectSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PreselectSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports the tag property on a completion item. + /// + [DataMember(Name = "tagSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemTagSupportSetting? TagSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports insert replace edit. + /// + [DataMember(Name = "insertReplaceSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool InsertReplaceSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating which properties a client can resolve lazily on a completion item. + /// + [DataMember(Name = "resolveSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ResolveSupportSetting? ResolveSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports the `insertTextMode` property on a completion item to override the whitespace handling mode as defined by the client. + /// + [DataMember(Name = "insertTextModeSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InsertTextModeSupportSetting? InsertTextModeSupport + { + get; + set; + } + + /// + /// Gets or sets the a value indicating whether the client supports completion item label details. + /// + [DataMember(Name = "labelDetailsSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool LabelDetailsSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTag.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTag.cs new file mode 100644 index 0000000000000..11f050341ead7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTag.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Completion item tags are extra annotations that tweak the rendering of a completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum CompletionItemTag + { + /// + /// Render a completion as obsolete, usually using a strike-out. + /// + Deprecated = 1, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTagSupportSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTagSupportSetting.cs new file mode 100644 index 0000000000000..d6ce2b4f3128b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionItemTagSupportSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents initialization setting for the tag property on a completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionItemTagSupportSetting + { + /// + /// Gets or sets a value indicating the tags supported by the client. + /// + [DataMember(Name = "valueSet", IsRequired = true)] + public CompletionItemTag[] ValueSet + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionList.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionList.cs new file mode 100644 index 0000000000000..849e8cf72230f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionList.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Class which represents a completion list. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionList + { + /// + /// Gets or sets a value indicating whether Items is the complete list of items or not. If incomplete is true, then + /// filtering should ask the server again for completion item. + /// + [DataMember(Name = "isIncomplete")] + public bool IsIncomplete + { + get; + set; + } + + /// + /// Gets or sets the list of completion items. + /// + [DataMember(Name = "items")] + public CompletionItem[] Items + { + get; + set; + } + + /// + /// Gets or sets the completion list item defaults. + /// + [DataMember(Name = "itemDefaults")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionListItemDefaults? ItemDefaults + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs new file mode 100644 index 0000000000000..8d450048aa1d7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Class which represents default properties associated with the entire completion list. + /// + [DataContract] + public class CompletionListItemDefaults + { + /// + /// Gets or sets the default commit character set. + /// + [DataMember(Name = "commitCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? CommitCharacters + { + get; + set; + } + + /// + /// Gets or sets the default edit range. + /// + [DataMember(Name = "editRange")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? EditRange + { + get; + set; + } + + /// + /// Gets or sets the default . + /// + [DataMember(Name = "insertTextFormat")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InsertTextFormat? InsertTextFormat + { + get; + set; + } + + /// + /// Gets or sets the default . + /// + [DataMember(Name = "insertTextMode")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InsertTextMode? InsertTextMode + { + get; + set; + } + + /// + /// Gets or sets the default completion item data. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListSetting.cs new file mode 100644 index 0000000000000..c412f802369ba --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Class which represents capabilites for the completion list type. + /// + [DataContract] + public class CompletionListSetting + { + /// + /// Gets or sets a value containing the supported property names of the object. + /// If omitted, no properties are supported. + /// + [DataMember(Name = "itemDefaults")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? ItemDefaults + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionOptions.cs new file mode 100644 index 0000000000000..b0d59ef58c461 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionOptions.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents completion capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets the trigger characters. + /// + [DataMember(Name = "triggerCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? TriggerCharacters + { + get; + set; + } + + /// + /// Gets or sets a value indicating all the possible commit characters associated with the language server. + /// + [DataMember(Name = "allCommitCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? AllCommitCharacters + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether server provides completion item resolve capabilities. + /// + [DataMember(Name = "resolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ResolveProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + + /// + /// Gets or sets completion item setting. + /// + [DataMember(Name = "completionItem")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemOptions? CompletionItemOptions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionParams.cs new file mode 100644 index 0000000000000..902351d9dabf9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionParams.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters for the textDocument/completion request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionParams : TextDocumentPositionParams, IPartialResultParams?> + { + /// + /// Gets or sets the completion context. + /// + [DataMember(Name = "context")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionContext? Context + { + get; + set; + } + + /// + /// Gets or sets the value of the PartialResultToken instance. + /// + [DataMember(Name = Methods.PartialResultTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress?>? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionSetting.cs new file mode 100644 index 0000000000000..1e71e6c6388ea --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionSetting.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents initialization setting for completion. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CompletionSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets completion item setting. + /// + [DataMember(Name = "completionItem")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemSetting? CompletionItem + { + get; + set; + } + + /// + /// Gets or sets specific settings. + /// + [DataMember(Name = "completionItemKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionItemKindSetting? CompletionItemKind + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client supports sending additional context. + /// + [DataMember(Name = "contextSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ContextSupport + { + get; + set; + } + + /// + /// Gets or sets a value indicating client's default when the completion item doesn't provide an `insertTextMode` property. + /// + [DataMember(Name = "insertTextMode")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InsertTextMode? InsertTextMode + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client supports capabilities on the completion list. + /// + [DataMember(Name = "completionList")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionListSetting? CompletionListSetting + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionTriggerKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionTriggerKind.cs new file mode 100644 index 0000000000000..7b5be46852a9c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionTriggerKind.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum which represents the various ways in which completion can be triggered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum CompletionTriggerKind + { + /// + /// Completion was triggered by typing an identifier. + /// + Invoked = 1, + + /// + /// Completion was triggered by typing a trigger character. + /// + TriggerCharacter = 2, + + /// + /// Completion was re-triggered as the current completion list is incomplete. + /// + TriggerForIncompleteCompletions = 3, + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationItem.cs new file mode 100644 index 0000000000000..9d9890f701c50 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationItem.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents an configuration item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ConfigurationItem + { + /// + /// Gets or sets the scope to get the configuration section for. + /// + [DataMember(Name = "scopeUri")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri? ScopeUri + { + get; + set; + } + + /// + /// Gets or sets the requested configuration section. + /// + [DataMember(Name = "section")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Section + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationParams.cs new file mode 100644 index 0000000000000..8f8bbf2ac4ed8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ConfigurationParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters for the workspace/configuration request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ConfigurationParams + { + /// + /// Gets or sets the ConfigurationItems being requested. + /// + [DataMember(Name = "items")] + public ConfigurationItem[] Items + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/DocumentUriConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/DocumentUriConverter.cs new file mode 100644 index 0000000000000..d2e0a9fa9e8cf --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/DocumentUriConverter.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Globalization; + using Microsoft.CommonLanguageServerProtocol.Framework; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// TODO: document. + /// + public class DocumentUriConverter : JsonConverter + { + /// + public override bool CanConvert(Type objectType) + { + return true; + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + if (reader.TokenType == JsonToken.String) + { + var token = JToken.ReadFrom(reader); + var uri = new Uri(token.ToObject()); + + return uri; + } + else if (reader.TokenType == JsonToken.Null) + { + return null; + } + + throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LSPFrameworkResources.DocumentUriSerializationError, reader.Value)); + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + if (value is Uri uri) + { + JToken token = JToken.FromObject(uri.AbsoluteUri); + token.WriteTo(writer); + } + else + { + throw new ArgumentException($"{nameof(value)} must be of type {nameof(Uri)}"); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/JsonConverterCollectionUtilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/JsonConverterCollectionUtilities.cs new file mode 100644 index 0000000000000..207ed168f25e6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/JsonConverterCollectionUtilities.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + + /// + /// Class containing extension method to thread-safely manage operations. + /// + internal static class JsonConverterCollectionUtilities + { + /// + /// Lock used for modifications to Converters collection. + /// + public static readonly object ConvertersLock = new object(); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/KindAttribute.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/KindAttribute.cs new file mode 100644 index 0000000000000..0f1cd4cd93035 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/KindAttribute.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + + /// + /// Attribute that defines the expected value of the JSON property when a type is + /// used in an . + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] + public class KindAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + /// The expected value of the JSON property. + /// The name of the property that is used to identify the contained type of the . + /// Specifying this attribute doesn't automatically include the JSON property upon serialization. + /// + /// In the current implementation the JSON property is always considered required. + public KindAttribute(string kind, string kindPropertyName = "kind") + { + this.Kind = kind ?? throw new ArgumentNullException(nameof(kind)); + this.KindPropertyName = kindPropertyName ?? throw new ArgumentNullException(nameof(kindPropertyName)); + } + + /// + /// Gets the expected value of the JSON property. + /// + public string Kind { get; private set; } + + /// + /// Gets the name of the property that is used to identify the contained type of the . + /// + public string KindPropertyName { get; private set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/ParameterInformationConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/ParameterInformationConverter.cs new file mode 100644 index 0000000000000..af829c0c9bdec --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/ParameterInformationConverter.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// JsonConverter to correctly deserialize int arrays in the Label param of ParameterInformation. + /// + public class ParameterInformationConverter : JsonConverter + { + /// + public override bool CanWrite => false; + + /// + public override bool CanConvert(Type objectType) + { + return true; + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + JToken token = JToken.Load(reader); + + var label = ((JObject)token).Property("label", StringComparison.Ordinal); + var documentation = ((JObject)token).Property("documentation", StringComparison.Ordinal); + + ParameterInformation parameter = new ParameterInformation(); + + if (label != null) + { + var value = label.Value; + if (value is JArray arr) + { + Tuple tuple = new Tuple(arr[0].Value(), arr[1].Value()); + parameter.Label = tuple; + } + else + { + // If label is not an array we can serialize it normally + parameter.Label = value.ToObject>>(); + } + } + + if (documentation != null) + { + var value = documentation.Value; + parameter.Documentation = value.ToObject?>(); + } + + return parameter; + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/StringEnumConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/StringEnumConverter.cs new file mode 100644 index 0000000000000..b6152fd4bcd7b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/StringEnumConverter.cs @@ -0,0 +1,102 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.ComponentModel; +using System.Globalization; +using System.Linq.Expressions; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Newtonsoft.Json; + +/// +/// JsonConverter for serializing and deserializing string-based enums. +/// +/// The actual type implementing . +public class StringEnumConverter + : JsonConverter + where TStringEnumType : IStringEnum +{ + private static readonly Func CreateEnum; + + static StringEnumConverter() + { + // TODO. When C# starts supporting static methods in interfaces, add a static Create method to IStringEnum and remove CreateEnum. + var constructor = typeof(TStringEnumType).GetConstructor(new Type[] { typeof(string) }); + if (constructor is null) + { + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, LSPFrameworkResources.StringEnumMissingConstructor, typeof(TStringEnumType).FullName)); + } + + ParameterExpression param = Expression.Parameter(typeof(string), "value"); + NewExpression body = Expression.New(constructor, param); + CreateEnum = Expression.Lambda>(body, param).Compile(); + } + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(TStringEnumType); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + + if (reader.TokenType == JsonToken.String) + { + return CreateEnum((string)reader.Value!); + } + else if (reader.TokenType == JsonToken.Null) + { + return default(TStringEnumType); + } + + throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LSPFrameworkResources.StringEnumSerializationError, reader.Value)); + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + if (value is TStringEnumType kind) + { + writer.WriteValue(kind.Value); + } + else + { + throw new ArgumentException($"{nameof(value)} must be of type {typeof(TStringEnumType).FullName}"); + } + } + + /// + /// Type converter from to . + /// This is required to support . + /// + public class TypeConverter + : System.ComponentModel.TypeConverter + { + /// + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + + return base.CanConvertFrom(context, sourceType); + } + + /// + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (value is string stringValue) + { + return CreateEnum(stringValue); + } + + return base.ConvertFrom(context, culture, value); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/SumConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/SumConverter.cs new file mode 100644 index 0000000000000..a51e3c7563a91 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/SumConverter.cs @@ -0,0 +1,269 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using Microsoft.CommonLanguageServerProtocol.Framework; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// Converter to translate to and from SumTypes. + /// + public class SumConverter : JsonConverter + { + private static readonly ConcurrentDictionary SumTypeCache = new ConcurrentDictionary(); + + /// + public override bool CanConvert(Type objectType) + { + return typeof(ISumType).IsAssignableFrom(objectType); + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); + + // Even if CanConvert only returns true for ISumType, ReadJson is invoked for Nullable> as well + if (reader.TokenType == JsonToken.Null) + { + if (objectType.IsGenericType && objectType.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return null; + } + else + { + // We shouldn't really ever have a non-Nullable SumType being received as null but, if we do, return an "empty" SumType + return Activator.CreateInstance(objectType); + } + } + + // objectType will be one of the various SumType variants. In order for this converter to work with all SumTypes it has to use reflection. + // This method works by attempting to deserialize the json into each of the type parameters to a SumType and stops at the first success. + SumTypeInfoCache sumTypeInfoCache = SumTypeCache.GetOrAdd(objectType, (t) => new SumTypeInfoCache(t)); + + JToken? token = null; + var applicableUnionTypeInfos = sumTypeInfoCache.GetApplicableInfos(reader.TokenType); + + for (var i = 0; i < applicableUnionTypeInfos.Count; i++) + { + SumTypeInfoCache.UnionTypeInfo unionTypeInfo = applicableUnionTypeInfos[i]; + + if (!IsTokenCompatibleWithType(reader, unionTypeInfo)) + { + continue; + } + + try + { + object? sumValue; + if (token == null && i + 1 == applicableUnionTypeInfos.Count) + { + // We're at the very last entry, we don't need to maintain the JsonReader, can read directly from the JsonReader to avoid the inbetween JObject type. + sumValue = serializer.Deserialize(reader, unionTypeInfo.Type); + } + else + { + if (token == null) + { + token = JToken.ReadFrom(reader); + } + + if (unionTypeInfo.KindAttribute is not null && + (token is not JObject jObject || jObject[unionTypeInfo.KindAttribute.KindPropertyName]?.ToString() != unionTypeInfo.KindAttribute.Kind)) + { + continue; + } + + sumValue = token.ToObject(unionTypeInfo.Type, serializer); + } + + object?[] args = { sumValue }; + var sum = unionTypeInfo.Constructor.Invoke(args); + return sum; + } + catch + { + continue; + } + } + + throw new JsonSerializationException(LSPFrameworkResources.NoSumTypeMatch); + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + if (value is null) + { + writer.WriteNull(); + } + else + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + var sumValue = ((ISumType)value!).Value; + + if (sumValue != null) + { + JToken token = JToken.FromObject(sumValue); + token.WriteTo(writer); + } + } + } + + private static bool IsTokenCompatibleWithType(JsonReader reader, SumTypeInfoCache.UnionTypeInfo unionTypeInfo) + { + bool isCompatible = true; + switch (reader.TokenType) + { + case JsonToken.Float: + isCompatible = unionTypeInfo.Type == typeof(double) || + unionTypeInfo.Type == typeof(float); + break; + case JsonToken.Boolean: + isCompatible = unionTypeInfo.Type == typeof(bool); + break; + case JsonToken.Integer: + isCompatible = unionTypeInfo.Type == typeof(int) || + unionTypeInfo.Type == typeof(uint) || + unionTypeInfo.Type == typeof(long) || + unionTypeInfo.Type == typeof(ulong) || + unionTypeInfo.Type == typeof(short) || + unionTypeInfo.Type == typeof(ushort) || + unionTypeInfo.Type == typeof(byte) || + unionTypeInfo.Type == typeof(sbyte) || + unionTypeInfo.Type == typeof(double) || + unionTypeInfo.Type == typeof(float); + break; + case JsonToken.String: + isCompatible = unionTypeInfo.Type == typeof(string) || + typeof(IStringEnum).IsAssignableFrom(unionTypeInfo.Type); + break; + } + + return isCompatible; + } + + private class SumTypeInfoCache + { + // netstandard1.0 doesn't support Array.Empty +#pragma warning disable CA1825 // Avoid zero-length array allocations. + private static readonly IReadOnlyList EmptyUnionInfos = new UnionTypeInfo[0]; +#pragma warning restore CA1825 // Avoid zero-length array allocations. + + private readonly IReadOnlyList allUnionTypeInfos; + + private readonly IReadOnlyList primitiveUnionTypeInfos; + + private readonly IReadOnlyList arrayUnionTypeInfos; + + private readonly IReadOnlyList objectUnionTypeInfos; + + public SumTypeInfoCache(Type sumTypeType) + { + var allUnionTypeInfosSet = new List(); + List? primitiveUnionTypeInfosSet = null; + List? arrayUnionTypeInfosSet = null; + List? objectUnionTypeInfosSet = null; + + // If the SumType is a nullable extract the underlying type and re-assign + sumTypeType = NormalizeToNonNullable(sumTypeType); + + var typeInfo = sumTypeType.GetTypeInfo(); + var parameterTypes = typeInfo.GenericTypeArguments; + foreach (var parameterType in parameterTypes) + { + var parameterTypeInfo = NormalizeToNonNullable(parameterType).GetTypeInfo(); + var declaredConstructor = typeInfo.GetConstructor(new Type[] { parameterType }) ?? + throw new ArgumentException(nameof(sumTypeType), "All constructor parameter types must be represented in the generic type arguments of the SumType"); + + KindAttribute? kindAttribute = parameterType.GetCustomAttribute(); + var unionTypeInfo = new UnionTypeInfo(parameterType, declaredConstructor, kindAttribute); + allUnionTypeInfosSet.Add(unionTypeInfo); + + if (parameterTypeInfo.IsPrimitive || + parameterTypeInfo == typeof(string) || + typeof(IStringEnum).IsAssignableFrom(parameterTypeInfo)) + { + primitiveUnionTypeInfosSet ??= new List(); + primitiveUnionTypeInfosSet.Add(unionTypeInfo); + } + else if (parameterTypeInfo.IsArray) + { + arrayUnionTypeInfosSet ??= new List(); + arrayUnionTypeInfosSet.Add(unionTypeInfo); + } + else + { + objectUnionTypeInfosSet ??= new List(); + objectUnionTypeInfosSet.Add(unionTypeInfo); + } + } + + this.allUnionTypeInfos = allUnionTypeInfosSet; + this.primitiveUnionTypeInfos = primitiveUnionTypeInfosSet ?? EmptyUnionInfos; + this.arrayUnionTypeInfos = arrayUnionTypeInfosSet ?? EmptyUnionInfos; + if ((objectUnionTypeInfosSet?.Count ?? 0) > 1) + { + // If some types are tagged with a KindAttribute, make sure they are first in the list in order to avoid the wrong type being deserialized + this.objectUnionTypeInfos = objectUnionTypeInfosSet.Where(t => t.KindAttribute is not null).Concat( + objectUnionTypeInfosSet.Where(t => t.KindAttribute is null)).ToList(); + } + else + { + this.objectUnionTypeInfos = objectUnionTypeInfosSet ?? EmptyUnionInfos; + } + } + + public IReadOnlyList GetApplicableInfos(JsonToken startingTokenType) + { + return startingTokenType switch + { + JsonToken.StartArray + => this.arrayUnionTypeInfos, + JsonToken.Integer or + JsonToken.Float or + JsonToken.Bytes or + JsonToken.String or + JsonToken.Boolean + => this.primitiveUnionTypeInfos, + JsonToken.StartObject + => this.objectUnionTypeInfos, + _ => this.allUnionTypeInfos, + }; + } + + private static Type NormalizeToNonNullable(Type sumTypeType) + { + return Nullable.GetUnderlyingType(sumTypeType) ?? sumTypeType; + } + + public class UnionTypeInfo + { + public UnionTypeInfo(Type type, ConstructorInfo constructor, KindAttribute? kindAttribute) + { + this.Type = type ?? throw new ArgumentNullException(nameof(type)); + this.Constructor = constructor ?? throw new ArgumentNullException(nameof(constructor)); + this.KindAttribute = kindAttribute; + } + + public Type Type { get; } + + public ConstructorInfo Constructor { get; } + + public KindAttribute? KindAttribute { get; } + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/TextDocumentSyncConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/TextDocumentSyncConverter.cs new file mode 100644 index 0000000000000..9819fc6628870 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Converters/TextDocumentSyncConverter.cs @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Globalization; + using Microsoft.CommonLanguageServerProtocol.Framework; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// Converter which offers custom serialization for enum to a object. + /// + /// + /// This is to support backwards compatibility for the protocol. + /// + public class TextDocumentSyncConverter : JsonConverter + { + /// + public override bool CanConvert(Type objectType) + { + return true; + } + + /// + /// Deserializes a json value to a object. + /// + /// Reader from which to read json value. + /// Type of the json value. + /// Existing value. + /// Default serializer. + /// A which matches the json value. + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + reader = reader ?? throw new ArgumentNullException(nameof(reader)); + if (reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Integer) + { + // This conversion is modeled after what VS Code does, see https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L1234 + var textDocSync = new TextDocumentSyncOptions + { + OpenClose = true, + Change = (TextDocumentSyncKind)int.Parse(reader.Value!.ToString(), NumberStyles.Integer, CultureInfo.CurrentCulture), + Save = new SaveOptions + { + IncludeText = false, + }, + }; + + return textDocSync; + } + else if (reader.TokenType == JsonToken.String) + { + return JsonConvert.DeserializeObject(reader.Value!.ToString()); + } + else if (reader.TokenType == JsonToken.StartObject) + { + var token = JToken.ReadFrom(reader); + return token.ToObject(); + } + else if (reader.TokenType == JsonToken.Null) + { + // This conversion is modeled after what VS Code does, see https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L1234 + var textDocSync = new TextDocumentSyncOptions + { + OpenClose = true, + Change = TextDocumentSyncKind.None, + Save = new SaveOptions + { + IncludeText = false, + }, + }; + + return textDocSync; + } + + throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, LSPFrameworkResources.TextDocumentSyncSerializationError, reader.Value)); + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + if (value is null) + { + writer.WriteNull(); + } + else + { + writer = writer ?? throw new ArgumentNullException(nameof(writer)); + + JToken token = JToken.FromObject(value); + token.WriteTo(writer); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFile.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFile.cs new file mode 100644 index 0000000000000..9c51a5fca9b29 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFile.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a create file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [Kind("create")] + public class CreateFile + { + /// + /// Gets the kind value. + /// + [DataMember(Name = "kind")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Member can't be static since it's part of the protocol")] + public string Kind => "create"; + + /// + /// Gets or sets the resource to create. + /// + [DataMember(Name = "uri", IsRequired = true)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the additional options. + /// + [DataMember(Name = "options")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CreateFileOptions? Options + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFileOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFileOptions.cs new file mode 100644 index 0000000000000..fc01b5e051205 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CreateFileOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for a create file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class CreateFileOptions + { + /// + /// Gets or sets a value indicating whether the creation should overwrite the file if it already exists. (Overwrite wins over ignoreIfExists). + /// + [DataMember(Name = "overwrite")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Overwrite + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the action should be ignored if the file already exists. + /// + [DataMember(Name = "ignoreIfExists")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool IgnoreIfExists + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CustomDictionary.xml b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CustomDictionary.xml new file mode 100644 index 0000000000000..1ab85c61f13c6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CustomDictionary.xml @@ -0,0 +1,7 @@ + + + + params + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefaultBehaviorPrepareRename.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefaultBehaviorPrepareRename.cs new file mode 100644 index 0000000000000..db9da5f10f528 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefaultBehaviorPrepareRename.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a possible result value of the 'textDocument/prepareRename' request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DefaultBehaviorPrepareRename + { + /// + /// Gets or sets a value indicating whether the rename position is valid and the client should use its + /// default behavior to compute the rename range. + /// + [DataMember(Name = "defaultBehavior")] + [JsonProperty(Required = Required.Always)] + public bool DefaultBehavior + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefinitionOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefinitionOptions.cs new file mode 100644 index 0000000000000..d83781d098fae --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DefinitionOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DefinitionOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFile.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFile.cs new file mode 100644 index 0000000000000..f65bd25b76795 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFile.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a delete file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [Kind("delete")] + public class DeleteFile + { + /// + /// Gets the kind value. + /// + [DataMember(Name = "kind")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Member can't be static since it's part of the protocol")] + public string Kind => "delete"; + + /// + /// Gets or sets the file to delete. + /// + [DataMember(Name = "uri", IsRequired = true)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the additional options. + /// + [DataMember(Name = "options")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DeleteFileOptions? Options + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFileOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFileOptions.cs new file mode 100644 index 0000000000000..ccf7914de16ab --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DeleteFileOptions.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for a create file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DeleteFileOptions + { + /// + /// Gets or sets a value indicating whether the delete operation should be applied recursively if a folder is denoted. (Overwrite wins over ignoreIfNotExists). + /// + [DataMember(Name = "recursive")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Recursive + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the action should be ignored if the file doesn't exists. + /// + [DataMember(Name = "ignoreIfNotExists")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool IgnoreIfNotExists + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Diagnostic.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Diagnostic.cs new file mode 100644 index 0000000000000..791cad3da5c4c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Diagnostic.cs @@ -0,0 +1,171 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Linq; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a source code diagnostic message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Diagnostic : IEquatable + { + /// + /// Gets or sets the source code range. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the diagnostic severity. + /// + [DataMember(Name = "severity")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticSeverity? Severity + { + get; + set; + } + + /// + /// Gets or sets the diagnostic's code, which usually appear in the user interface. + /// + /// + /// The value can be an , . + /// + [DataMember(Name = "code")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Code + { + get; + set; + } + + /// + /// Gets or sets an optional value that describes the error code. + /// + [DataMember(Name = "codeDescription")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeDescription? CodeDescription + { + get; + set; + } + + /// + /// Gets or sets a human-readable string describing the source of this + /// diagnostic, e.g. 'typescript' or 'super lint'. It usually appears in the user interface. + /// + [DataMember(Name = "source")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Source + { + get; + set; + } + + /// + /// Gets or sets the diagnostic's message. + /// + [DataMember(Name = "message")] + public string Message + { + get; + set; + } + + /// + /// Gets or sets the diagnostic's tags. + /// + [DataMember(Name = "tags")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticTag[]? Tags + { + get; + set; + } + + /// + /// Gets or sets the diagnostic related information + /// + [DataMember(Name = "relatedInformation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticRelatedInformation[]? RelatedInformation + { + get; + set; + } + + public static bool operator ==(Diagnostic? value1, Diagnostic? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(Diagnostic? value1, Diagnostic? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(Diagnostic other) + { + return other is not null + && this.Range == other.Range + && this.Severity == other.Severity + && object.Equals(this.Code, other.Code) + && this.CodeDescription == other.CodeDescription + && string.Equals(this.Source, other.Source, StringComparison.Ordinal) + && string.Equals(this.Message, other.Message, StringComparison.Ordinal) + && (this.Tags == null ? + other.Tags == null : + this.Tags.Equals(other.Tags) || this.Tags.SequenceEqual(other.Tags)); + } + + /// + public override bool Equals(object obj) + { + if (obj is Diagnostic other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return (this.Range == null ? 53 : this.Range.GetHashCode() * 13) + ^ (this.Severity.GetHashCode() * 17) + ^ (this.Code == null ? 47 : this.Code.GetHashCode() * 19) + ^ (this.Source == null ? 61 : this.Source.GetHashCode() * 79) + ^ (this.Message == null ? 83 : this.Message.GetHashCode() * 23) + ^ (this.Tags == null ? 89 : this.Tags.Sum(t => t.GetHashCode()) * 73) + ^ (this.CodeDescription == null ? 23 : this.CodeDescription.GetHashCode() * 29); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticOptions.cs new file mode 100644 index 0000000000000..78503eaf17153 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticOptions.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Server capabilities for pull diagnostics. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DiagnosticOptions : IWorkDoneProgressOptions +{ + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + + /// + /// Gets or sets the identifier in which the diagnostics are bucketed by the client. + /// + [DataMember(Name = "identifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Identifier + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the language has inter file dependencies. + /// + [DataMember(Name = "interFileDependencies")] + public bool InterFileDependencies + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support for workspace diagnostics as well. + /// + [DataMember(Name = "workspaceDiagnostics")] + public bool WorkspaceDiagnostics + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRegistrationOptions.cs new file mode 100644 index 0000000000000..48d5b0481db87 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRegistrationOptions.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Diagnostic registration options. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DiagnosticRegistrationOptions : DiagnosticOptions, IStaticRegistrationOptions, ITextDocumentRegistrationOptions +{ + /// + /// Gets or sets the document filters for this registration option. + /// + [DataMember(Name = "documentSelector")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public DocumentFilter[]? DocumentSelector + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "id")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Id + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRelatedInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRelatedInformation.cs new file mode 100644 index 0000000000000..f8c62220990c9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticRelatedInformation.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents a related message and source code location for a diagnostic. + /// This should be used to point to code locations that cause or are related to + /// a diagnostics, e.g when duplicating a symbol in a scope. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DiagnosticRelatedInformation + { + /// + /// Gets or sets the location for the related information. + /// + [DataMember(Name = "location")] + public Location Location { get; set; } + + /// + /// Gets or sets the message for the related information. + /// + [DataMember(Name = "message")] + public string Message { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticServerCancellationData.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticServerCancellationData.cs new file mode 100644 index 0000000000000..a1389b46efead --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticServerCancellationData.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; + +/// +/// Class representing the cancellation data returned from a diagnostic request. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DiagnosticServerCancellationData +{ + /// + /// Gets or sets a value indicating whether the client should re-trigger the request. + /// + [DataMember(Name = "retriggerRequest")] + public bool RetriggerRequest + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSetting.cs new file mode 100644 index 0000000000000..ade46a1d77caa --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSetting.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Client settings for pull diagnostics. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DiagnosticSetting : DynamicRegistrationSetting +{ + /// + /// Gets or sets a value indicating whether the client supports related documents for document diagnostic pulls. + /// + [DataMember(Name = "relatedDocumentSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RelatedDocumentSupport { get; set; } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSeverity.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSeverity.cs new file mode 100644 index 0000000000000..30c93a3debb61 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticSeverity.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Diagnostic severity enum. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum DiagnosticSeverity + { + /// + /// Error. + /// + Error = 1, + + /// + /// Warning. + /// + Warning = 2, + + /// + /// Information. + /// + Information = 3, + + /// + /// Hint. + /// + Hint = 4, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticTag.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticTag.cs new file mode 100644 index 0000000000000..42d3f94deb339 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticTag.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Diagnostic tag enum. + /// Additional metadata about the type of a diagnostic + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum DiagnosticTag + { + /// + /// Unused or unnecessary code. + /// Diagnostics with this tag are rendered faded out. + /// + Unnecessary = 1, + + /// + /// Deprecated or obsolete code. + /// Clients are allowed to rendered diagnostics with this tag strike through. + /// + Deprecated = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticWorkspaceSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticWorkspaceSetting.cs new file mode 100644 index 0000000000000..6bc7284af40f4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DiagnosticWorkspaceSetting.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing the workspace diagnostic client capabilities. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DiagnosticWorkspaceSetting +{ + /// + /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client. + /// + [DataMember(Name = "refreshSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RefreshSupport { get; set; } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeConfigurationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeConfigurationParams.cs new file mode 100644 index 0000000000000..7d03790c2fc09 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeConfigurationParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter sent with workspace/didChangeConfiguration requests. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidChangeConfigurationParams + { + /// + /// Gets or sets the settings that are applicable to the language server. + /// + [DataMember(Name = "settings")] + public object Settings + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeTextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeTextDocumentParams.cs new file mode 100644 index 0000000000000..0099a8dc63e84 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeTextDocumentParams.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with textDocument/didChange message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidChangeTextDocumentParams : ITextDocumentParams + { + /// + /// Gets or sets the document that changed. + /// + [DataMember(Name = "textDocument")] + public VersionedTextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the content changes. + /// + [DataMember(Name = "contentChanges")] + public TextDocumentContentChangeEvent[] ContentChanges + { + get; + set; + } + + TextDocumentIdentifier ITextDocumentParams.TextDocument + { + get => this.TextDocument; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeWatchedFilesParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeWatchedFilesParams.cs new file mode 100644 index 0000000000000..394f46c93c73a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidChangeWatchedFilesParams.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with workspace/didChangeWatchedFiles message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidChangeWatchedFilesParams + { + /// + /// Gets or sets of the collection of file change events. + /// + [DataMember(Name = "changes")] + public FileEvent[] Changes + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidCloseTextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidCloseTextDocumentParams.cs new file mode 100644 index 0000000000000..26b2388f21c2c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidCloseTextDocumentParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with textDocument/didClose message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidCloseTextDocumentParams : ITextDocumentParams + { + /// + /// Gets or sets the text document identifier. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidOpenTextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidOpenTextDocumentParams.cs new file mode 100644 index 0000000000000..a8be38f83c060 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidOpenTextDocumentParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with textDocument/didOpen message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidOpenTextDocumentParams + { + /// + /// Gets or sets the which represents the text document that was opened. + /// + [DataMember(Name = "textDocument")] + public TextDocumentItem TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidSaveTextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidSaveTextDocumentParams.cs new file mode 100644 index 0000000000000..edd8e2cbb5802 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DidSaveTextDocumentParams.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the parameter that is sent with a textDocument/didSave message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DidSaveTextDocumentParams : ITextDocumentParams + { + /// + /// Gets or sets the which represents the text document that was saved. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the which represents the content of the text document when it was saved. + /// + [DataMember(Name = "text")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Text + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorOptions.cs new file mode 100644 index 0000000000000..367116b89d9d3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentColorOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorParams.cs new file mode 100644 index 0000000000000..aac0dc034d9e6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentColorParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for a textDocument/documentColor request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentColorParams : ITextDocumentParams + { + /// + /// Gets or sets the to provide links for. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticParams.cs new file mode 100644 index 0000000000000..2035f1e7909f0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticParams.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing the document diagnostic request parameters +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DocumentDiagnosticParams : ITextDocumentParams, IPartialResultParams> +{ + /// + /// Gets or sets the value of the Progress instance. + /// + /// + /// Note that the first literal send needs to be either the or + /// followed by n literals. + /// + [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress>? PartialResultToken + { + get; + set; + } + + /// + /// Gets or sets the to provide diagnostics for. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the identifier for which the client is requesting diagnostics for. + /// + [DataMember(Name = "identifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Identifier + { + get; + set; + } + + /// + /// Gets or sets the result id of a previous diagnostics response if provided. + /// + [DataMember(Name = "previousResultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? PreviousResultId + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportKind.cs new file mode 100644 index 0000000000000..30efcc8483aa7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportKind.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Value representing the kind of the document diagnostic report. +/// +/// See the Language Server Protocol specification for additional information. +/// +internal static class DocumentDiagnosticReportKind +{ + /// + /// Kind representing a diagnostic report with a full set of problems. + /// + public const string Full = "full"; + + /// + /// Kind representing a diagnostic report indicating that the last returned report is still accurate. + /// + public const string Unchanged = "unchanged"; +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportPartialResult.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportPartialResult.cs new file mode 100644 index 0000000000000..3099875f60624 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentDiagnosticReportPartialResult.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +/// +/// Class representing a partial document diagnostic report for a set of related documents. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class DocumentDiagnosticReportPartialResult +{ + /// + /// Gets or sets the map of related document diagnostic reports. + /// + [DataMember(Name = "relatedDocuments")] + public Dictionary> RelatedDocuments + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFilter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFilter.cs new file mode 100644 index 0000000000000..a3cdf0dd84f4a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFilter.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a filter over certain types of documents + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentFilter + { + /// + /// Gets or sets a language id for the filter (e.g. 'typescript'). + /// + [DataMember(Name = "language")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Language + { + get; + set; + } + + /// + /// Gets or sets a Uri scheme (e.g. 'file' or 'untitled'). + /// + [DataMember(Name = "scheme")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Scheme + { + get; + set; + } + + /// + /// Gets or sets a glob pattern (e.g. '*.cs'). + /// + [DataMember(Name = "pattern")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Pattern + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingOptions.cs new file mode 100644 index 0000000000000..59baefc6d6f9a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the document formatting options for server capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentFormattingOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingParams.cs new file mode 100644 index 0000000000000..2dae0d2814d66 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentFormattingParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with textDocument/formatting message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentFormattingParams : ITextDocumentParams + { + /// + /// Gets or sets the identifier for the text document to be formatted. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the formatting options. + /// + [DataMember(Name = "options")] + public FormattingOptions Options + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlight.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlight.cs new file mode 100644 index 0000000000000..f0aba083f0530 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlight.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the response from a textDocument/documentHighlight request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentHighlight + { + /// + /// Gets or sets the range that the highlight applies to. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the kind of highlight. + /// + [DataMember(Name = "kind")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + [DefaultValue(DocumentHighlightKind.Text)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public DocumentHighlightKind Kind + { + get; + set; + } = DocumentHighlightKind.Text; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightKind.cs new file mode 100644 index 0000000000000..9f4c13f374cb7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightKind.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum representing the different types of document highlight. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum DocumentHighlightKind + { + /// + /// A textual occurance. + /// + Text = 1, + + /// + /// Read access of a symbol. + /// + Read = 2, + + /// + /// Write access of a symbol. + /// + Write = 3, + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightOptions.cs new file mode 100644 index 0000000000000..ea906e42d2fe9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentHighlightOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightParams.cs new file mode 100644 index 0000000000000..dcbd15f23a105 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentHighlightParams.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent for a textDocument/documentHighlight request. + /// + /// See the Language Server Protocol specification for additional information. + /// + public class DocumentHighlightParams + : TextDocumentPositionParams, + IPartialResultParams + { + /// + /// Gets or sets the value of the PartialResultToken instance. + /// + [DataMember(Name = "partialResultToken")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLink.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLink.cs new file mode 100644 index 0000000000000..cf90cdac2b54c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLink.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the response of a textDocument/documentLink request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentLink + { + /// + /// Gets or sets the range the link applies to. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the uri that the link points to. + /// + [DataMember(Name = "target")] + [JsonConverter(typeof(DocumentUriConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Uri? Target + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkOptions.cs new file mode 100644 index 0000000000000..c91ae4ab5b426 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the document link options for server capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentLinkOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether or not the server supports resolve providers. + /// + [DataMember(Name = "resolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ResolveProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkParams.cs new file mode 100644 index 0000000000000..e27d4661d04ac --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentLinkParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for a textDocument/documentLink request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentLinkParams : ITextDocumentParams + { + /// + /// Gets or sets the to provide links for. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingOptions.cs new file mode 100644 index 0000000000000..526f6c6c6a2f5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingOptions.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for on type formatting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentOnTypeFormattingOptions + { + /// + /// Gets or sets the first trigger character. + /// + [DataMember(Name = "firstTriggerCharacter")] + public string FirstTriggerCharacter + { + get; + set; + } + + /// + /// Gets or sets additional trigger characters. + /// + [DataMember(Name = "moreTriggerCharacter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? MoreTriggerCharacter + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingParams.cs new file mode 100644 index 0000000000000..dea20819b5b14 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentOnTypeFormattingParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for a textDocument/onTypeFormatting request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentOnTypeFormattingParams : TextDocumentPositionParams + { + /// + /// Gets or sets the character that was typed. + /// + [DataMember(Name = "ch")] + public string Character + { + get; + set; + } + + /// + /// Gets or sets the for the request. + /// + [DataMember(Name = "options")] + public FormattingOptions Options + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingOptions.cs new file mode 100644 index 0000000000000..3d12227abe545 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the document range formatting options for server capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentRangeFormattingOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingParams.cs new file mode 100644 index 0000000000000..166ed8392287d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentRangeFormattingParams.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter that is sent with textDocument/rangeFormatting message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentRangeFormattingParams : ITextDocumentParams + { + /// + /// Gets or sets the identifier for the text document to be formatted. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the selection range to be formatted. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the formatting options. + /// + [DataMember(Name = "options")] + public FormattingOptions Options + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbol.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbol.cs new file mode 100644 index 0000000000000..3f6343cd13c0b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbol.cs @@ -0,0 +1,96 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be + /// hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, + /// e.g. the range of an identifier. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentSymbol + { + /// + /// Gets or sets the name of this symbol. + /// + [DataMember(IsRequired = true, Name = "name")] + public string Name + { + get; + set; + } + + /// + /// Gets or sets more detail for this symbol, e.g the signature of a function. + /// + [DataMember(Name = "detail")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Detail + { + get; + set; + } + + /// + /// Gets or sets the of this symbol. + /// + [DataMember(Name = "kind")] + public SymbolKind Kind + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether this symbol is deprecated. + /// + [DataMember(Name = "deprecated")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Deprecated + { + get; + set; + } + + /// + /// Gets or sets the range enclosing this symbol not including leading/trailing whitespace but everything else + /// like comments.This information is typically used to determine if the clients cursor is + /// inside the symbol to reveal in the symbol in the UI. + /// + [DataMember(IsRequired = true, Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + /// Must be contained by the `range`. + /// + [DataMember(IsRequired = true, Name = "selectionRange")] + public Range SelectionRange + { + get; + set; + } + + /// + /// Gets or sets the children of this symbol, e.g. properties of a class. + /// + [DataMember(Name = "children")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DocumentSymbol[]? Children + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolOptions.cs new file mode 100644 index 0000000000000..ab38da668bcad --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentSymbolOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolParams.cs new file mode 100644 index 0000000000000..a983e69fdbbbf --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the parameter sent with textDocument/documentSymbol requests. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentSymbolParams : ITextDocumentParams + { + /// + /// Gets or sets the text document. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolSetting.cs new file mode 100644 index 0000000000000..b68dce8989039 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DocumentSymbolSetting.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the initialization setting for document symbols. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class DocumentSymbolSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets the capabilities. + /// + [DataMember(Name = "symbolKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SymbolKindSetting? SymbolKind + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the document has hierarchical symbol support. + /// + [DataMember(Name = "hierarchicalDocumentSymbolSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool HierarchicalDocumentSymbolSupport + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DynamicRegistrationSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DynamicRegistrationSetting.cs new file mode 100644 index 0000000000000..c14b5c5548b4e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/DynamicRegistrationSetting.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a setting that can be dynamically registered. + /// + [DataContract] + public class DynamicRegistrationSetting + { + /// + /// Initializes a new instance of the class. + /// + public DynamicRegistrationSetting() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Value indicating whether the setting can be dynamically registered. + public DynamicRegistrationSetting(bool value) + { + this.DynamicRegistration = value; + } + + /// + /// Gets or sets a value indicating whether setting can be dynamically registered. + /// + [DataMember(Name = "dynamicRegistration")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DynamicRegistration + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandOptions.cs new file mode 100644 index 0000000000000..17380bb843519 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandOptions.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for execute command support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ExecuteCommandOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets the commands that are to be executed on the server. + /// + [DataMember(Name = "commands")] + public string[] Commands + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandParams.cs new file mode 100644 index 0000000000000..eeeeec583e037 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ExecuteCommandParams.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent from client to server for the workspace/executeCommand request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ExecuteCommandParams + { + /// + /// Gets or sets the command identifier associated with the command handler. + /// + [DataMember(Name = "command")] + public string Command + { + get; + set; + } + + /// + /// Gets or sets the arguments that the command should be invoked with. + /// + [DataMember(Name = "arguments")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object[]? Arguments + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionConverter.cs new file mode 100644 index 0000000000000..bf1a6a03b879f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionConverter.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using Newtonsoft.Json; + + /// + /// Converter used to serialize and deserialize classes extending types defined in the + /// Microsoft.VisualStudio.LanguageServer.Protocol package. + /// + /// Base class that is specified in the + /// Microsoft.VisualStudio.LanguageServer.Protocol package. + /// Extension class that extends TBase. + public class VSExtensionConverter : JsonConverter + where TExtension : TBase + { + /// + public override bool CanWrite => false; + + /// + public override bool CanConvert(Type objectType) + { + return objectType == typeof(TBase); + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + return serializer.Deserialize(reader); + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionUtilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionUtilities.cs new file mode 100644 index 0000000000000..a42d1363512c7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/Converters/VSExtensionUtilities.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + + /// + /// Utility functions to simplify working with the Visual Studio extensions to the Language Server Protocol. + /// + public static class VSExtensionUtilities + { + /// + /// Adds to the allowing to + /// deserialize the JSON stream into objects which include Visual Studio specific extensions. + /// + /// For example, it allows to correctly deserialize the entries of a + /// 'codeAction/resolve' request into objects even if + /// is defined as an array of . + /// + /// + /// If is used in parallel to the execution of this method, + /// its access needs to be synchronized with this method call, to guarantee that the + /// collection is not modified when is in use. + /// + /// Instance of to be configured. + public static void AddVSExtensionConverters(this JsonSerializer serializer) + { + // Reading the number of converters before we start adding new ones + int existingConvertersCount = serializer.Converters.Count; + + TryAddConverter(); + TryAddConverter(); + TryAddConverter(); + TryAddConverter(); + TryAddConverter(); + + void TryAddConverter() + where TExtension : TBase + { + for (int i = 0; i < existingConvertersCount; i++) + { + var existingConverterType = serializer.Converters[i].GetType(); + if (existingConverterType.IsGenericType && + existingConverterType.GetGenericTypeDefinition() == typeof(VSExtensionConverter<,>) && + existingConverterType.GenericTypeArguments[0] == typeof(TBase)) + { + return; + } + } + + serializer.Converters.Add(new VSExtensionConverter()); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnostic.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnostic.cs new file mode 100644 index 0000000000000..31d2608f91fb2 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnostic.cs @@ -0,0 +1,68 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// extends providing additional properties used by Visual Studio. + /// + [DataContract] + public class VSDiagnostic : Diagnostic + { + /// + /// Gets or sets the project and context (e.g. Win32, MacOS, etc.) in which the diagnostic was generated. + /// + [DataMember(Name = "_vs_projects")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSDiagnosticProjectInformation[]? Projects { get; set; } + + /// + /// Gets or sets an expanded description of the diagnostic. + /// + [DataMember(Name = "_vs_expandedMessage")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ExpandedMessage { get; set; } + + /// + /// Gets or sets a message shown when the user hovers over an error. If , then + /// is used (use to prevent a tool tip from being shown). + /// + [DataMember(Name = "_vs_toolTip")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ToolTip { get; set; } + + /// + /// 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). + /// + [DataMember(Name = "_vs_identifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Identifier { get; set; } + + /// + /// Gets or sets a string describing the diagnostic types (e.g. Security, Performance, Style, etc.). + /// + [DataMember(Name = "_vs_diagnosticType")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? DiagnosticType { get; set; } + + /// + /// Gets or sets a rank associated with this diagnostic, used for the default sort. + /// will be used if no rank is specified. + /// + [DataMember(Name = "_vs_diagnosticRank")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSDiagnosticRank? DiagnosticRank { get; set; } + + /// + /// Gets or sets an ID used to associate this diagnostic with a corresponding line in the output window. + /// + [DataMember(Name = "_vs_outputId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? OutputId { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticProjectInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticProjectInformation.cs new file mode 100644 index 0000000000000..6af4da7319218 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticProjectInformation.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// represents the project and context in which the is generated. + /// + [DataContract] + public class VSDiagnosticProjectInformation + { + /// + /// Gets or sets a human-readable identifier for the project in which the diagnostic was generated. + /// + [DataMember(Name = "_vs_projectName")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ProjectName { get; set; } + + /// + /// Gets or sets a human-readable identifier for the build context (e.g. Win32 or MacOS) + /// in which the diagnostic was generated. + /// + [DataMember(Name = "_vs_context")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Context { get; set; } + + /// + /// Gets or sets the unique identifier for the project in which the diagnostic was generated. + /// + [DataMember(Name = "_vs_projectIdentifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ProjectIdentifier { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticRank.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticRank.cs new file mode 100644 index 0000000000000..cd9a243a96c56 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticRank.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// represents the rank of a object. + /// + public enum VSDiagnosticRank + { + /// + /// Highest priority. + /// + Highest = 100, + + /// + /// High priority. + /// + High = 200, + + /// + /// Default priority. + /// + Default = 300, + + /// + /// Low priority. + /// + Low = 400, + + /// + /// Lowest priority. + /// + Lowest = 500, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticTags.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticTags.cs new file mode 100644 index 0000000000000..83869dfc32953 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSDiagnosticTags.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Additional values that are specific to Visual Studio. + /// + public static class VSDiagnosticTags + { + /// + /// A entry generated by the build. + /// + public const DiagnosticTag BuildError = (DiagnosticTag)(-1); + + /// + /// A entry generated by Intellisense. + /// + public const DiagnosticTag IntellisenseError = (DiagnosticTag)(-2); + + /// + /// A entry that could be generated from both builds + /// and Intellisense. + /// + /// entries tagged with will be hidden + /// in the error list if the error list is displaying build and intellisense + /// errors. + /// + public const DiagnosticTag PotentialDuplicate = (DiagnosticTag)(-3); + + /// + /// A entry is never displayed in the error list. + /// + public const DiagnosticTag HiddenInErrorList = (DiagnosticTag)(-4); + + /// + /// The entry is always displayed in the error list. + /// + public const DiagnosticTag VisibleInErrorList = (DiagnosticTag)(-5); + + /// + /// The entry is never displayed in the editor. + /// + public const DiagnosticTag HiddenInEditor = (DiagnosticTag)(-6); + + /// + /// No tooltip is shown for the entry in the editor. + /// + public const DiagnosticTag SuppressEditorToolTip = (DiagnosticTag)(-7); + + /// + /// The entry is represented in the Editor as an Edit + /// and Continue error. + /// + public const DiagnosticTag EditAndContinueError = (DiagnosticTag)(-8); + + /// + /// A entry is represented in the Editor as a Task List item in the TODO list. + /// + public const DiagnosticTag TaskItem = (DiagnosticTag)(-9); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSGetProjectContextsParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSGetProjectContextsParams.cs new file mode 100644 index 0000000000000..7136b29bf9918 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSGetProjectContextsParams.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// represents the parameter that is sent + /// with the 'textDocument/_vs_getProjectContexts' request. + /// + [DataContract] + public class VSGetProjectContextsParams + { + /// + /// Gets or sets the document for which project contexts are queried. + /// + [DataMember(Name = "_vs_textDocument")] + public TextDocumentItem TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSImageId.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSImageId.cs new file mode 100644 index 0000000000000..a6930c976df81 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSImageId.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + + /// + /// represents the unique identifier for a Visual Studio image asset. + /// The identified is composed by a and an integer. + /// A list of valid image ids can be retrieved from the KnownMonikers class + /// from the Visual Studio SDK. + /// + [DataContract] + public class VSImageId : IEquatable + { + /// + /// Gets or sets the component of the unique identifier. + /// + [DataMember(Name = "_vs_guid")] + public Guid Guid + { + get; + set; + } + + /// + /// Gets or sets the integer component of the unique identifier. + /// + [DataMember(Name = "_vs_id")] + public int Id + { + get; + set; + } + + /// + public override bool Equals(object obj) + { + return this.Equals(obj as VSImageId); + } + + /// + public bool Equals(VSImageId? other) + { + return other != null && + this.Guid == other.Guid && + this.Id == other.Id; + } + + /// + public override int GetHashCode() + { + int hashCode = 184147724; + hashCode = (hashCode * -1521134295) + this.Guid.GetHashCode(); + hashCode = (hashCode * -1521134295) + this.Id.GetHashCode(); + return hashCode; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSLocation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSLocation.cs new file mode 100644 index 0000000000000..0dd862b5cbedb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSLocation.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// extends providing additional properties used by Visual Studio. + /// + [DataContract] + public class VSLocation : Location + { + /// + /// Gets or sets the project name to be displayed to user. + /// + [DataMember(Name = "_vs_projectName")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ProjectName { get; set; } + + /// + /// 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 method. + /// + [DataMember(Name = "_vs_displayPath")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? DisplayPath { get; set; } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSMethods.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSMethods.cs new file mode 100644 index 0000000000000..3a51751c2919d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSMethods.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// contains the string values for all Language Server Protocol Visual Studio specific methods. + /// + public static class VSMethods + { + /// + /// 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 and a return value of type + /// . + /// In order to enable the client to send the 'textDocument/_vs_getProjectContexts' requests, the server must + /// set the property. + /// + public const string GetProjectContextsName = "textDocument/_vs_getProjectContexts"; + + /// + /// Strongly typed request object for 'textDocument/_vs_getProjectContexts'. + /// + public static readonly LspRequest GetProjectContexts = new LspRequest(GetProjectContextsName); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContext.cs new file mode 100644 index 0000000000000..1c62be132f0a1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContext.cs @@ -0,0 +1,96 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + + /// + /// represents a project context. + /// + [DataContract] + public class VSProjectContext : IEquatable + { + /// + /// Gets or sets the label for the project context. + /// + [DataMember(Name = "_vs_label", IsRequired = true)] + public string Label + { + get; + set; + } + + /// + /// Gets or sets the unique identifier of the project context. + /// + [DataMember(Name = "_vs_id", IsRequired = true)] + public string Id + { + get; + set; + } + + /// + /// Gets or sets the context kind of the project context which is used to determine its associated icon. + /// + [DataMember(Name = "_vs_kind")] + public VSProjectKind Kind + { + get; + set; + } + + public static bool operator ==(VSProjectContext? value1, VSProjectContext? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (value2 is null) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(VSProjectContext? value1, VSProjectContext? value2) + { + return !(value1 == value2); + } + + /// + public virtual bool Equals(VSProjectContext other) + { + return string.Equals(this.Label, other.Label, StringComparison.Ordinal) + && string.Equals(this.Id, other.Id, StringComparison.Ordinal) + && this.Kind == other.Kind; + } + + /// + public override bool Equals(object obj) + { + if (obj is VSProjectContext other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return (this.Label == null ? 53 : this.Label.GetHashCode() * 13) + ^ (this.Id == null ? 61 : this.Id.GetHashCode() * 17) + ^ (this.Kind.GetHashCode() * 19); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContextList.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContextList.cs new file mode 100644 index 0000000000000..858fd4bb90c26 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectContextList.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// represents the response to the + /// 'textDocument/_vs_getProjectContexts' request. + /// + [DataContract] + public class VSProjectContextList + { + /// + /// Gets or sets the document contexts associated with a text document. + /// + [DataMember(Name = "_vs_projectContexts")] + public VSProjectContext[] ProjectContexts + { + get; + set; + } + + /// + /// Gets or sets the index of the default entry of the array. + /// + [DataMember(Name = "_vs_defaultIndex")] + public int DefaultIndex + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectKind.cs new file mode 100644 index 0000000000000..3590f5f4d6a32 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSProjectKind.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// represents the various kinds of contexts. + /// + [DataContract] + public enum VSProjectKind + { + /// + /// C++ project. + /// + CPlusPlus = 1, + + /// + /// C# project. + /// + CSharp = 2, + + /// + /// Visual Basic project. + /// + VisualBasic = 3, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSServerCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSServerCapabilities.cs new file mode 100644 index 0000000000000..db8766d37e5da --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSServerCapabilities.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// extends allowing to provide + /// additional capabilities supported by Visual Studio. + /// + [DataContract] + public class VSServerCapabilities : ServerCapabilities + { + /// + /// Gets or sets a value indicating whether the server supports the + /// 'textDocument/_vs_getProjectContexts' request. + /// + [DataMember(Name = "_vs_projectContextProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ProjectContextProvider + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSSymbolInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSSymbolInformation.cs new file mode 100644 index 0000000000000..6b1454744feff --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSSymbolInformation.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// extends providing additional properties used by Visual Studio. + /// + [DataContract] + public class VSSymbolInformation : SymbolInformation + { + /// + /// Gets or sets the icon associated with the symbol. If specified, this icon is used instead of . + /// + [DataMember(Name = "_vs_icon")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSImageId? Icon { get; set; } + + /// + /// Gets or sets the description of the symbol. + /// + [DataMember(Name = "_vs_description")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Description { get; set; } + + /// + /// Gets or sets the hint text for the symbol. + /// + [DataMember(Name = "_vs_hintText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? HintText { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSTextDocumentIdentifier.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSTextDocumentIdentifier.cs new file mode 100644 index 0000000000000..31d037f33b2ae --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Extensions/VSTextDocumentIdentifier.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// extends providing additional properties used by Visual Studio. + /// + [DataContract] + public class VSTextDocumentIdentifier : TextDocumentIdentifier, IEquatable + { + /// + /// Gets or sets the project context of the text document. + /// + [DataMember(Name = "_vs_projectContext")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSProjectContext? ProjectContext + { + get; + set; + } + + public static bool operator ==(VSTextDocumentIdentifier? value1, VSTextDocumentIdentifier? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(VSTextDocumentIdentifier? value1, VSTextDocumentIdentifier? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(VSTextDocumentIdentifier other) + { + return this.ProjectContext == other.ProjectContext + && base.Equals(other); + } + + /// + public override bool Equals(object obj) + { + if (obj is VSTextDocumentIdentifier other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return this.ProjectContext == null ? 89 : this.ProjectContext.GetHashCode() + ^ (base.GetHashCode() * 79); + } + + /// + public override string ToString() + { + var result = base.ToString(); + if (this.ProjectContext != null) + { + result += "|" + this.ProjectContext.Label + "|" + this.ProjectContext.Id; + } + + return result; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileChangeType.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileChangeType.cs new file mode 100644 index 0000000000000..593485a47ab99 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileChangeType.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// File event type enum. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum FileChangeType + { + /// + /// File was created. + /// + Created = 1, + + /// + /// File was changed. + /// + Changed = 2, + + /// + /// File was deleted. + /// + Deleted = 3, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileEvent.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileEvent.cs new file mode 100644 index 0000000000000..58ef6f9c85a10 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FileEvent.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a file change event. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FileEvent + { + /// + /// Gets or sets the URI of the file. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the file change type. + /// + [DataMember(Name = "type")] + public FileChangeType FileChangeType + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRange.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRange.cs new file mode 100644 index 0000000000000..7fc8afe3878c8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRange.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a folding range in a document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FoldingRange + { + /// + /// Gets or sets the start line value. + /// + [DataMember(Name = "startLine")] + public int StartLine + { + get; + set; + } + + /// + /// Gets or sets the start character value. + /// + [DataMember(Name = "startCharacter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? StartCharacter + { + get; + set; + } + + /// + /// Gets or sets the end line value. + /// + [DataMember(Name = "endLine")] + public int EndLine + { + get; + set; + } + + /// + /// Gets or sets the end character value. + /// + [DataMember(Name = "endCharacter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? EndCharacter + { + get; + set; + } + + /// + /// Gets or sets the folding range kind. + /// + [DataMember(Name = "kind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public FoldingRangeKind? Kind + { + get; + set; + } + + /// + /// Gets or sets the collapsedText. + /// + [DataMember(Name = "collapsedText")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? CollapsedText + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeKind.cs new file mode 100644 index 0000000000000..ea67ef309d1b8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeKind.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Value representing various code action kinds. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct FoldingRangeKind(string Value) : IStringEnum + { + /// + /// Comment folding range. + /// + public static readonly FoldingRangeKind Comment = new("comment"); + + /// + /// Imports folding range. + /// + public static readonly FoldingRangeKind Imports = new("imports"); + + /// + /// Region folding range. + /// + public static readonly FoldingRangeKind Region = new("region"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeOptions.cs new file mode 100644 index 0000000000000..9ccdc111c2857 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the folding range provider options for initialization. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FoldingRangeOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeParams.cs new file mode 100644 index 0000000000000..ca0dba06b616c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the folding range request parameter. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FoldingRangeParams : ITextDocumentParams + { + /// + /// Gets or sets the text document associated with the folding range request. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSetting.cs new file mode 100644 index 0000000000000..7fdc5f9a496b5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSetting.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the folding range setting for initialization. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FoldingRangeSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets the range limit for folding ranges. + /// + [DataMember(Name = "rangeLimit")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? RangeLimit + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether if client only supports entire line folding only. + /// + [DataMember(Name = "lineFoldingOnly")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool LineFoldingOnly + { + get; + set; + } + + /// + /// Gets or sets a value indicating the specific options for the folding range. + /// + [DataMember(Name = "foldingRange")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public FoldingRangeSettingOptions? FoldingRange + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSettingOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSettingOptions.cs new file mode 100644 index 0000000000000..f4559cdc353d5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FoldingRangeSettingOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the specific options for the folding range. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FoldingRangeSettingOptions : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating whether if client supports collapsedText on folding ranges. + /// + [DataMember(Name = "collapsedText")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool CollapsedText + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FormattingOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FormattingOptions.cs new file mode 100644 index 0000000000000..e730d088f2067 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FormattingOptions.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents formatting options. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class FormattingOptions + { + /// + /// Gets or sets the number of spaces to be inserted per tab. + /// + [DataMember(Name = "tabSize")] + public int TabSize + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether tabs should be spaces. + /// + [DataMember(Name = "insertSpaces")] + public bool InsertSpaces + { + get; + set; + } + + /// + /// Gets or sets the other potential formatting options. + /// + [JsonExtensionData] + public Dictionary? OtherOptions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FullDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FullDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..62353cfe4fd39 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/FullDocumentDiagnosticReport.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a diagnostic report with a full set of problems. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Full)] +public class FullDocumentDiagnosticReport +{ + /// + /// Gets the kind of this report. + /// + [DataMember(Name = "kind")] + public string Kind => DocumentDiagnosticReportKind.Full; + + /// + /// Gets or sets the optional result id. + /// + [DataMember(Name = "resultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ResultId + { + get; + set; + } + + /// + /// Gets or sets the diagnostics in this report. + /// + [DataMember(Name = "items")] + public Diagnostic[] Items + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Hover.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Hover.cs new file mode 100644 index 0000000000000..e9742fbb1a5fa --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Hover.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the data returned by a textDocument/hover request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Hover + { + /// + /// Gets or sets the content for the hover. Object can either be an array or a single object. + /// If the object is an array the array can contain objects of type and . + /// If the object is not an array it can be of type , , or . + /// + // This is nullable because in VS we allow null when VSInternalHover.RawContent is specified instead of Contents + [DataMember(Name = "contents")] + public SumType[], MarkupContent>? Contents + { + get; + set; + } + + /// + /// Gets or sets the range over which the hover applies. + /// + [DataMember(Name = "range")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Range? Range + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverOptions.cs new file mode 100644 index 0000000000000..a607cae20666a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the server hover support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class HoverOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverSetting.cs new file mode 100644 index 0000000000000..1c0957bab7992 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/HoverSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the initialization setting for hover. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class HoverSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets the values supported. + /// + [DataMember(Name = "contentFormat")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public MarkupKind[]? ContentFormat + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IPartialResultParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IPartialResultParams.cs new file mode 100644 index 0000000000000..29514aa95b141 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IPartialResultParams.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + + /// + /// Interface to describe parameters for requests that support streaming results. + /// + /// See the Language Server Protocol specification for additional information. + /// + /// The type to be reported by . + public interface IPartialResultParams + { + /// + /// Gets or sets the value of the PartialResultToken instance. + /// + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStaticRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStaticRegistrationOptions.cs new file mode 100644 index 0000000000000..84e6c4cc2c8fb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStaticRegistrationOptions.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Interface representing the static registration options for options returned in the initialize request. +/// +/// See the Language Server Protocol specification for additional information. +/// +public interface IStaticRegistrationOptions +{ + /// + /// Gets or sets the id used to register the request. The id can be used to deregister the request again. + /// + public string? Id { get; set; } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStringEnum.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStringEnum.cs new file mode 100644 index 0000000000000..243219a2c4042 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IStringEnum.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Interface that describes a string-based enumeration. +/// String-based enumerations are serialized simply as their . +/// +/// +/// When implementing this interface, a constructor that takes a single string as parameters is required by +/// . +/// +public interface IStringEnum +{ + /// + /// Gets the value of the enumeration. + /// + string Value { get; } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ISumType.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ISumType.cs new file mode 100644 index 0000000000000..0f73e0e7f0e22 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ISumType.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Abstracts over the idea of a "sum type". Sum types are types that can contain one value of various types. + /// This abstraction is guaranteed to be typesafe, meaning you cannot access the underlying value without knowing + /// its specific type. + /// + public interface ISumType + { + /// + /// Gets the value stored in the SumType. This can be matched against using the "is" operator. + /// + object? Value { get; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentParams.cs new file mode 100644 index 0000000000000..cca47c92dcd95 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentParams.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Interface to identify a text document. + /// + public interface ITextDocumentParams + { + /// + /// Gets or sets the value which identifies the document. + /// + public TextDocumentIdentifier TextDocument + { + get; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentPositionParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentPositionParams.cs new file mode 100644 index 0000000000000..d144cfff47918 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentPositionParams.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Interface to identify a text document and a position inside that document. + /// + /// See the Language Server Protocol specification for additional information. + /// + public interface ITextDocumentPositionParams : ITextDocumentParams + { + /// + /// Gets or sets the value which identifies the document. + /// + public new TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the value which indicates the position within the document. + /// + public Position Position + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentRegistrationOptions.cs new file mode 100644 index 0000000000000..c8f7d0bd38387 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ITextDocumentRegistrationOptions.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Interface representing the text document registration options. +/// +/// See the Language Server Protocol specification for additional information. +/// +public interface ITextDocumentRegistrationOptions +{ + /// + /// Gets or sets the document filters for this registration option. + /// + public DocumentFilter[]? DocumentSelector { get; set; } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IWorkDoneProgressOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IWorkDoneProgressOptions.cs new file mode 100644 index 0000000000000..d522a0fd552ef --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/IWorkDoneProgressOptions.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Options to signal work done progress support in server capabilities. + /// + internal interface IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + /// See the Language Server Protocol specification for additional information. + /// + bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ImplementationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ImplementationOptions.cs new file mode 100644 index 0000000000000..60da928f86cf9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ImplementationOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ImplementationOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeError.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeError.cs new file mode 100644 index 0000000000000..d28b7245df408 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeError.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the error type sent when the initialize request fails. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InitializeError + { + /// + /// Gets or sets a value indicating whether or not to retry. + /// + [DataMember(Name = "retry")] + public bool Retry + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeErrorCode.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeErrorCode.cs new file mode 100644 index 0000000000000..f66b3cccb621a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeErrorCode.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum representing the possible reasons for an initialization error. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum InitializeErrorCode + { + /// + /// Protocol version can't be handled by the server. + /// + UnknownProtocolVersion = 1, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeParams.cs new file mode 100644 index 0000000000000..ea94d6ec6a34b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeParams.cs @@ -0,0 +1,108 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the parameter sent with an initialize method request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InitializeParams + { + /// + /// Gets or sets the ID of the process which launched the language server. + /// + [DataMember(Name = "processId")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public int? ProcessId + { + get; + set; + } + + /// + /// Gets or sets the locale the client is currently showing the user interface in. + /// This must not necessarily be the locale of the operating system. + /// + /// Uses IETF language tags as the value's syntax. + /// (See https://en.wikipedia.org/wiki/IETF_language_tag) + /// + [DataMember(Name = "locale")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Locale + { + get; + set; + } + + /// + /// Gets or sets the workspace root path. + /// + [DataMember(Name = "rootPath")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + [Obsolete("Deprecated in favour of RootUri")] + public string? RootPath + { + get; + set; + } + + /// + /// Gets or sets the workspace root path. + /// + /// + /// This should be a string representation of an URI. + /// + [DataMember(Name = "rootUri")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri? RootUri + { + get; + set; + } + + /// + /// Gets or sets the initialization options as specified by the client. + /// + [DataMember(Name = "initializationOptions")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? InitializationOptions + { + get; + set; + } + + /// + /// Gets or sets the capabilities supported by the client. + /// + [DataMember(Name = "capabilities")] + public ClientCapabilities Capabilities + { + get; + set; + } + + /// + /// Gets or sets the initial trace setting. + /// + [DataMember(Name = "trace")] + [DefaultValue(typeof(TraceSetting), "off")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public TraceSetting Trace + { + get; + set; +#pragma warning disable SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line + } = TraceSetting.Off; +#pragma warning restore SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeResult.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeResult.cs new file mode 100644 index 0000000000000..e0b2b875a29bb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializeResult.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents the result returned by the initialize request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InitializeResult + { + /// + /// Gets or sets the server capabilities. + /// + [DataMember(Name = "capabilities")] + public ServerCapabilities Capabilities + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializedParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializedParams.cs new file mode 100644 index 0000000000000..f7fb23469c815 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InitializedParams.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class containing information sent with the 'initialized' notification. + /// + /// See the Language Server Protocol specification for additional information. + /// + public class InitializedParams + { + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs new file mode 100644 index 0000000000000..2bb86ffadfe71 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A class representing inlay hints that appear next to parameters or types. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHint + { + /// + /// Gets or sets the position that the inlay hint applies to. + /// + [DataMember(Name = "position")] + public Position Position + { + get; + set; + } + + /// + /// Gets or sets the label associated with this inlay hint. + /// + [DataMember(Name = "label")] + public SumType Label + { + get; + set; + } + + /// + /// Gets or sets the InlayHintKind associated with this inlay hint. + /// + [DataMember(Name = "kind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InlayHintKind? Kind + { + get; + set; + } + + /// + /// Gets or sets the TextEdits associated with this inlay hint. + /// + [DataMember(Name = "textEdits")] + [JsonProperty (NullValueHandling = NullValueHandling.Ignore)] + public TextEdit[]? TextEdits + { + get; + set; + } + + /// + /// Gets or sets the tooltip of this inlay hint. + /// + [DataMember(Name = "tooltip")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? ToolTip + { + get; + set; + } + + /// + /// Gets or sets the padding before this inlay hint. + /// + [DataMember(Name = "paddingLeft")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PaddingLeft + { + get; + set; + } + + /// + /// Gets or sets the padding after this inlay hint. + /// + [DataMember(Name = "paddingRight")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PaddingRight + { + get; + set; + } + + /// + /// Gets or sets the data that should be preserved between a textDocument/inlayHint request and a inlayHint/resolve request. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintKind.cs new file mode 100644 index 0000000000000..25f4b4fbe04e4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintKind.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum values for inlay hint kinds. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum InlayHintKind + { + /// + /// Type. + /// + Type = 1, + + /// + /// Parameter. + /// + Parameter = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintLabelPart.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintLabelPart.cs new file mode 100644 index 0000000000000..ba44b2611e8d9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintLabelPart.cs @@ -0,0 +1,61 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + using System.Runtime.Serialization; + + /// + /// A class representing inlay hint label parts. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintLabelPart + { + /// + /// Gets or sets the value associated with this label part. + /// + [DataMember(Name = "value")] + public string Value + { + get; + set; + } + + /// + /// Gets or sets the tooltip of this label part. + /// + [DataMember(Name = "tooltip")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public SumType? ToolTip + { + get; + set; + } + + /// + /// Gets or sets the location of this label part. + /// + [DataMember(Name = "location")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Location? Location + { + get; + set; + } + + /// + /// Gets or sets the command of this label part. + /// + [DataMember(Name = "command")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Command? Command + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintOptions.cs new file mode 100644 index 0000000000000..d9c7090522f69 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + using System.Runtime.Serialization; + + /// + /// Server capabilities for inlay hints. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether or not the inlay hints support has a resolve provider. + /// + [DataMember(Name = "resolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ResolveProvider + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintParams.cs new file mode 100644 index 0000000000000..9bd700604fa9d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent from the client to the server for a textDocument/inlayHint request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintParams : ITextDocumentParams + { + /// + /// Gets or sets the document identifier to fetch inlay hints results for. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the range to fetch inlay hints results for. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintRegistrationOptions.cs new file mode 100644 index 0000000000000..b99f220b9246d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintRegistrationOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + using System.Runtime.Serialization; + + /// + /// Inlay hint registration options. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintRegistrationOptions : InlayHintOptions, ITextDocumentRegistrationOptions, IStaticRegistrationOptions + { + /// + /// Gets or sets the document filters for this registration option. + /// + [DataMember(Name = "documentSelector")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public DocumentFilter[]? DocumentSelector + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "id")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Id + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintResolveSupportSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintResolveSupportSetting.cs new file mode 100644 index 0000000000000..8977ef014fff5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintResolveSupportSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing settings for inlayHint/resolve support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintResolveSupportSetting + { + /// + /// Gets or sets a value indicating the properties that a client can resolve lazily. + /// + [DataMember(Name = "properties")] + public string[] Properties + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintSetting.cs new file mode 100644 index 0000000000000..52377987c63cc --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintSetting.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing settings for inlay hint support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating whether the client supports + /// resolving lazily on an inlay hint. + /// + [DataMember(Name = "resolveSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InlayHintResolveSupportSetting? ResolveSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintWorkspaceSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintWorkspaceSetting.cs new file mode 100644 index 0000000000000..d9f57113b7ffc --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHintWorkspaceSetting.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Newtonsoft.Json; +using System.Runtime.Serialization; + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class representing the workspace inlay hint client capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InlayHintWorkspaceSetting + { + /// + /// Gets or sets a value indicating whether the client supports a refresh request sent from the server to the client. + /// + [DataMember(Name = "refreshSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RefreshSupport { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceEdit.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceEdit.cs new file mode 100644 index 0000000000000..1163a1baadcfa --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceEdit.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// A special text edit to provide an insert and a replace operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InsertReplaceEdit + { + /// + /// Gets or sets the string to be inserted. + /// + [DataMember(Name = "newText", IsRequired = true)] + public string NewText + { + get; + set; + } + + /// + /// Gets or sets the range range if the insert is requested + /// + [DataMember(Name = "insert", IsRequired = true)] + public Range Insert + { + get; + set; + } + + /// + /// Gets or sets the range range if the replace is requested + /// + [DataMember(Name = "replace", IsRequired = true)] + public Range Replace + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceRange.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceRange.cs new file mode 100644 index 0000000000000..aadc4536f4296 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertReplaceRange.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents default range of InsertReplaceEdit for the entire completion list + /// + [DataContract] + public class InsertReplaceRange + { + /// + /// Gets or sets the insert range. + /// + [DataMember(Name = "insert", IsRequired = true)] + public Range Insert + { + get; + set; + } + + /// + /// Gets or sets the replace edit range. + /// + [DataMember(Name = "replace", IsRequired = true)] + public Range Replace + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextFormat.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextFormat.cs new file mode 100644 index 0000000000000..3a1770df5d576 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextFormat.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum representing insert text format for completion items. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum InsertTextFormat + { + /// + /// Completion item insertion is plaintext. + /// + Plaintext = 1, + + /// + /// Completion item insertion is snippet. + /// + Snippet = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextMode.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextMode.cs new file mode 100644 index 0000000000000..ad0852fe0a6e8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextMode.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// How whitespace and indentation is handled during completion item insertion. + /// + /// See the Language Server Protocol specification for additional information. + /// + public enum InsertTextMode + { + /// + /// The insertion or replace strings is taken as it is. + /// + AsIs = 1, + + /// + /// The editor adjusts leading whitespace of new lines so that they match the indentation up to the cursor of the line for which the item is accepted. + /// + AdjustIndentation = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextModeSupportSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextModeSupportSetting.cs new file mode 100644 index 0000000000000..3ba1a2f3f8e7c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InsertTextModeSupportSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents initialization setting for the tag property on a completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class InsertTextModeSupportSetting + { + /// + /// Gets or sets a value indicating the client supports the `insertTextMode` property on a completion item to override the whitespace handling mode as defined by the client. + /// + [DataMember(Name = "valueSet", IsRequired = true)] + public InsertTextMode[] ValueSet + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs new file mode 100644 index 0000000000000..5e965acb612e3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs @@ -0,0 +1,84 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Linq; +using Roslyn.Text.Adornments; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// JsonConverter for serializing and deserializing . +/// +public class ClassifiedTextElementConverter : JsonConverter +{ + /// + /// A reusable instance of the . + /// + public static readonly ClassifiedTextElementConverter Instance = new(); + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(ClassifiedTextElement); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var typeProperty = data[ObjectContentConverter.TypeProperty]; + if (typeProperty is not null && typeProperty.ToString() != nameof(ClassifiedTextElement)) + { + throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ClassifiedTextElement)}"); + } + + var runTokens = data[nameof(ClassifiedTextElement.Runs)]?.ToArray() ?? + throw new JsonSerializationException($"Missing {nameof(ClassifiedTextElement.Runs)} property"); + var runs = new ClassifiedTextRun[runTokens.Length]; + for (int i = 0; i < runTokens.Length; i++) + { + var runTokenReader = runTokens[i].CreateReader(); + runTokenReader.Read(); + runs[i] = (ClassifiedTextRun)ClassifiedTextRunConverter.Instance.ReadJson(runTokenReader, typeof(ClassifiedTextRun), null, serializer)!; + } + + return new ClassifiedTextElement(runs); + } + else + { + throw new JsonSerializationException("Expected start object or null tokens"); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is not ClassifiedTextElement classifiedTextElement) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + writer.WritePropertyName(nameof(ClassifiedTextElement.Runs)); + writer.WriteStartArray(); + foreach (var run in classifiedTextElement.Runs) + { + ClassifiedTextRunConverter.Instance.WriteJson(writer, run, serializer); + } + + writer.WriteEndArray(); + writer.WritePropertyName(ObjectContentConverter.TypeProperty); + writer.WriteValue(nameof(ClassifiedTextElement)); + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs new file mode 100644 index 0000000000000..43672d8b7fac4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs @@ -0,0 +1,91 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using Roslyn.Text.Adornments; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// JsonConverter for serializing and deserializing . +/// +public class ClassifiedTextRunConverter : JsonConverter +{ + /// + /// A reusable instance of the . + /// + public static readonly ClassifiedTextRunConverter Instance = new(); + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(ClassifiedTextRun); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var typeProperty = data[ObjectContentConverter.TypeProperty]; + if (typeProperty is not null && typeProperty.ToString() != nameof(ClassifiedTextRun)) + { + throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ClassifiedTextRun)}"); + } + + var classificationTypeName = data[nameof(ClassifiedTextRun.ClassificationTypeName)]?.Value(); + var text = data[nameof(ClassifiedTextRun.Text)]?.Value(); + var markerTagType = data[nameof(ClassifiedTextRun.MarkerTagType)]?.Value(); + ClassifiedTextRunStyle style = (ClassifiedTextRunStyle)(data[nameof(ClassifiedTextRun.Style)]?.Value() ?? 0); + return new ClassifiedTextRun(classificationTypeName, text, style, markerTagType); + } + else + { + throw new JsonSerializationException("Expected start object or null tokens"); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is not ClassifiedTextRun classifiedTextRun) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + writer.WritePropertyName(nameof(ClassifiedTextRun.ClassificationTypeName)); + writer.WriteValue(classifiedTextRun.ClassificationTypeName); + writer.WritePropertyName(nameof(ClassifiedTextRun.Text)); + writer.WriteValue(classifiedTextRun.Text); + writer.WritePropertyName(nameof(ClassifiedTextRun.MarkerTagType)); + writer.WriteValue(classifiedTextRun.MarkerTagType); + writer.WritePropertyName(nameof(ClassifiedTextRun.Style)); + writer.WriteValue(classifiedTextRun.Style); + writer.WritePropertyName(nameof(ClassifiedTextRun.Tooltip)); + writer.WriteNull(); + if (classifiedTextRun.Tooltip is not null) + { + throw new JsonSerializationException(); + } + + writer.WritePropertyName(nameof(ClassifiedTextRun.NavigationAction)); + writer.WriteNull(); + if (classifiedTextRun.NavigationAction is not null) + { + throw new JsonSerializationException(); + } + + writer.WritePropertyName(ObjectContentConverter.TypeProperty); + writer.WriteValue(nameof(ClassifiedTextRun)); + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ContainerElementConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ContainerElementConverter.cs new file mode 100644 index 0000000000000..3a42e0e6a089a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ContainerElementConverter.cs @@ -0,0 +1,87 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Linq; +using Roslyn.Text.Adornments; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// JsonConverter for serializing and deserializing . +/// +public class ContainerElementConverter : JsonConverter +{ + /// + /// A reusable instance of the . + /// + public static readonly ContainerElementConverter Instance = new(); + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(ContainerElement); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var typeProperty = data[ObjectContentConverter.TypeProperty]; + if (typeProperty is not null && typeProperty.ToString() != nameof(ContainerElement)) + { + throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ContainerElement)}"); + } + + var elementTokens = data[nameof(ContainerElement.Elements)]?.ToArray() ?? + throw new JsonSerializationException($"Missing {nameof(ContainerElement.Elements)} property"); + var elements = new object?[elementTokens.Length]; + for (int i = 0; i < elementTokens.Length; i++) + { + var elementTokenReader = elementTokens[i].CreateReader(); + elementTokenReader.Read(); + elements[i] = ObjectContentConverter.Instance.ReadJson(elementTokenReader, typeof(object), null, serializer); + } + + ContainerElementStyle style = (ContainerElementStyle)(data[nameof(ContainerElement.Style)]?.Value() ?? throw new JsonSerializationException()); + return new ContainerElement(style, elements); + } + else + { + throw new JsonSerializationException("Expected start object or null tokens"); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is not ContainerElement containerElement) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + writer.WritePropertyName(nameof(ContainerElement.Elements)); + writer.WriteStartArray(); + foreach (var run in containerElement.Elements) + { + ObjectContentConverter.Instance.WriteJson(writer, run, serializer); + } + + writer.WriteEndArray(); + writer.WritePropertyName(nameof(ContainerElement.Style)); + writer.WriteValue(containerElement.Style); + writer.WritePropertyName(ObjectContentConverter.TypeProperty); + writer.WriteValue(nameof(ContainerElement)); + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/DropProgressConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/DropProgressConverter.cs new file mode 100644 index 0000000000000..c90ae5564650a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/DropProgressConverter.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Linq; + using Newtonsoft.Json; + + /// + /// Converter used to deserialize objects dropping any property. + /// + public class DropProgressConverter : JsonConverter + { + /// + public override bool CanWrite => true; + + /// + /// Static method to get a containing a . + /// + /// object containing a . + public static JsonSerializer CreateSerializer() + { + JsonSerializer serializer = new JsonSerializer(); + serializer.Converters.Add(new DropProgressConverter()); + return serializer; + } + + /// + public override bool CanConvert(Type objectType) + { + bool isIProgressOfT = objectType.IsConstructedGenericType && objectType.GetGenericTypeDefinition().Equals(typeof(IProgress<>)); + bool implementsIProgressOfT = objectType.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition().Equals(typeof(IProgress<>))); + + return isIProgressOfT || implementsIProgressOfT; + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + // We deserialize all IProgress objects as null. + return null; + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + writer.WriteNull(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageElementConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageElementConverter.cs new file mode 100644 index 0000000000000..33d4cb6fe9317 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageElementConverter.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using Roslyn.Core.Imaging; +using Roslyn.Text.Adornments; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// JsonConverter for serializing and deserializing . +/// +public class ImageElementConverter : JsonConverter +{ + /// + /// A reusable instance of the . + /// + public static readonly ImageElementConverter Instance = new(); + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(ImageElement); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var typeProperty = data[ObjectContentConverter.TypeProperty]; + if (typeProperty is not null && typeProperty.ToString() != nameof(ImageElement)) + { + throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ImageElement)}"); + } + + var imageTokenReader = data[nameof(ImageElement.ImageId)]?.CreateReader() ?? throw new JsonSerializationException(); + imageTokenReader.Read(); + var imageId = (ImageId)ImageIdConverter.Instance.ReadJson(imageTokenReader, typeof(ImageId), null, serializer)!; + var automationName = data[nameof(ImageElement.AutomationName)]?.Value(); + return automationName is null ? new ImageElement(imageId) : new ImageElement(imageId, automationName); + } + else + { + throw new JsonSerializationException("Expected start object or null tokens"); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is not ImageElement imageElement) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + writer.WritePropertyName(nameof(ImageElement.ImageId)); + ImageIdConverter.Instance.WriteJson(writer, imageElement.ImageId, serializer); + writer.WritePropertyName(nameof(ImageElement.AutomationName)); + writer.WriteValue(imageElement.AutomationName); + writer.WritePropertyName(ObjectContentConverter.TypeProperty); + writer.WriteValue(nameof(ImageElement)); + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageIdConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageIdConverter.cs new file mode 100644 index 0000000000000..8df28a7f029f8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ImageIdConverter.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using Roslyn.Core.Imaging; +using Roslyn.Text.Adornments; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// JsonConverter for serializing and deserializing . +/// +public class ImageIdConverter : JsonConverter +{ + /// + /// A reusable instance of the . + /// + public static readonly ImageIdConverter Instance = new(); + + /// + public override bool CanConvert(Type objectType) => objectType == typeof(ImageId); + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var typeProperty = data[ObjectContentConverter.TypeProperty]; + if (typeProperty is not null && typeProperty.ToString() != nameof(ImageId)) + { + throw new JsonSerializationException($"Expected {ObjectContentConverter.TypeProperty} property value {nameof(ImageId)}"); + } + + var guid = data[nameof(ImageId.Guid)]?.Value() ?? throw new JsonSerializationException(); + var id = data[nameof(ImageId.Id)]?.Value() ?? throw new JsonSerializationException(); + return new ImageId(new Guid(guid), id); + } + else + { + throw new JsonSerializationException("Expected start object or null tokens"); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is not ImageId imageId) + { + writer.WriteNull(); + } + else + { + writer.WriteStartObject(); + writer.WritePropertyName(nameof(ImageId.Guid)); + writer.WriteValue(imageId.Guid); + writer.WritePropertyName(nameof(ImageId.Id)); + writer.WriteValue(imageId.Id); + writer.WritePropertyName(ObjectContentConverter.TypeProperty); + writer.WriteValue(nameof(ImageId)); + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ObjectContentConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ObjectContentConverter.cs new file mode 100644 index 0000000000000..84b04e302d9b3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/ObjectContentConverter.cs @@ -0,0 +1,116 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using Roslyn.Core.Imaging; + using Roslyn.Text.Adornments; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// Object Content converter used to serialize and deserialize Text and Adornements from VS. + /// + /// This converts the following types: + /// + /// , + /// , + /// , + /// , + /// . + /// + /// Every other type is serialized as a string using the method. + /// + public class ObjectContentConverter : JsonConverter + { + /// + /// The property name used to save the .NET Type name of the serialized object. + /// + public const string TypeProperty = "_vs_type"; + + /// + /// A reusable instance of the . + /// + public static readonly ObjectContentConverter Instance = new ObjectContentConverter(); + + /// + public override bool CanConvert(Type objectType) + { + return objectType == typeof(object); + } + + /// + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) + { + reader.Read(); + return null; + } + else if (reader.TokenType == JsonToken.StartObject) + { + var data = JObject.Load(reader); + var type = data[TypeProperty]?.ToString() ?? throw new JsonSerializationException(); + + var tokenReader = data.CreateReader(); + tokenReader.Read(); + switch (type) + { + case nameof(ImageId): + return ImageIdConverter.Instance.ReadJson(tokenReader, typeof(ImageId), null, serializer); + case nameof(ImageElement): + return ImageElementConverter.Instance.ReadJson(tokenReader, typeof(ImageElement), null, serializer); + case nameof(ContainerElement): + return ContainerElementConverter.Instance.ReadJson(tokenReader, typeof(ContainerElementConverter), null, serializer); + case nameof(ClassifiedTextElement): + return ClassifiedTextElementConverter.Instance.ReadJson(tokenReader, typeof(ClassifiedTextElementConverter), null, serializer); + case nameof(ClassifiedTextRun): + return ClassifiedTextRunConverter.Instance.ReadJson(tokenReader, typeof(ClassifiedTextRunConverter), null, serializer); + default: + return data; + } + } + else + { + return serializer.Deserialize(reader); + } + } + + /// + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + return; + } + + switch (value) + { + case ImageId: + ImageIdConverter.Instance.WriteJson(writer, value, serializer); + break; + case ImageElement: + ImageElementConverter.Instance.WriteJson(writer, value, serializer); + break; + case ContainerElement: + ContainerElementConverter.Instance.WriteJson(writer, value, serializer); + break; + case ClassifiedTextElement: + ClassifiedTextElementConverter.Instance.WriteJson(writer, value, serializer); + break; + case ClassifiedTextRun: + ClassifiedTextRunConverter.Instance.WriteJson(writer, value, serializer); + break; + default: + // According to the docs of ContainerElement point to https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.text.adornments.iviewelementfactoryservice + // which states that Editor supports ClassifiedTextElement, ContainerElement, ImageElement and that other objects would be presented using ToString unless an extender + // exports a IViewElementFactory for that type. So I will simply serialize unknown objects as strings. + writer.WriteValue(value.ToString()); + break; + } + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/RegexConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/RegexConverter.cs new file mode 100644 index 0000000000000..b9e6203938574 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/RegexConverter.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Text.RegularExpressions; + + using Newtonsoft.Json; + + /// + /// Similar to https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform?path=/src/Productivity/TextMate/Core/LanguageConfiguration/Impl/FastRegexConverter.cs + /// to allow us to only compile the regex option once. + /// + internal class RegexConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + // nameof is faster than typeof, so below is a fast path. + return objectType.Name == nameof(Regex) && objectType == typeof(Regex); + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + // Create a custom deserializer for regex as the default provided by newtonsoft doesn't + // specify the Compiled option. + string? regexText = reader.Value as string; + if (string.IsNullOrEmpty(regexText)) + { + return null; + } + + return new Regex(regexText, RegexOptions.Compiled | RegexOptions.ECMAScript, matchTimeout: TimeSpan.FromMilliseconds(1000)); + } + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is Regex valueAsRegex) + { + writer.WriteValue(valueAsRegex.ToString()); + } + else + { + throw new ArgumentException($"{nameof(value)} must be of type {nameof(Regex)}"); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs new file mode 100644 index 0000000000000..88ea7c7eaed75 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Converters/VSInternalExtensionUtilities.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using Newtonsoft.Json; + + /// + /// Utilities to aid work with the LSP Extensions. + /// + public static class VSInternalExtensionUtilities + { + /// + /// Adds necessary to deserialize + /// JSON stream into objects which include VS-specific extensions. + /// + /// + /// If is used in parallel to execution of this method, + /// its access needs to be synchronized with this method call, to guarantee that + /// collection is not modified when in use. + /// + /// Instance of which is guaranteed to not work in parallel to this method call. + public static void AddVSInternalExtensionConverters(this JsonSerializer serializer) + { + VSExtensionUtilities.AddVSExtensionConverters(serializer); + + // Reading the number of converters before we start adding new ones + int existingConvertersCount = serializer.Converters.Count; + + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + AddOrReplaceConverter(); + + void AddOrReplaceConverter() + where TExtension : TBase + { + for (int i = 0; i < existingConvertersCount; i++) + { + var existingConverterType = serializer.Converters[i].GetType(); + if (existingConverterType.IsGenericType && + existingConverterType.GetGenericTypeDefinition() == typeof(VSExtensionConverter<,>) && + existingConverterType.GenericTypeArguments[0] == typeof(TBase)) + { + serializer.Converters.RemoveAt(i); + existingConvertersCount--; + break; + } + } + + serializer.Converters.Add(new VSExtensionConverter()); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs new file mode 100644 index 0000000000000..fdc157cb6f6c2 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Value representing the kind of a diagnostic. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct VSInternalDiagnosticKind(string Value) : IStringEnum + { + /// + /// Task list diagnostic kind. + /// + public static readonly VSInternalDiagnosticKind Task = new("task"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs new file mode 100644 index 0000000000000..e3d9e883657f0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticOptions.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Server provided options for pull diagnostic requests. + /// + [DataContract] + public class VSInternalDiagnosticOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a list of id's used to identify diagnostics that may be coming + /// from build systems instead of a language server. + /// + /// VS client will then use the information to do any merging logic in the Error List. + /// Maps to . + /// + [DataMember(Name = "_vs_buildOnlyDiagnosticIds")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? BuildOnlyDiagnosticIds + { + get; + set; + } + + /// + /// Gets or sets a list of diagnostic kinds used to query diagnostics in each context. + /// + [DataMember(Name = "_vs_diagnosticKinds")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDiagnosticKind[]? DiagnosticKinds + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "_vs_workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs new file mode 100644 index 0000000000000..6118ca6162f07 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticParams.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Class representing a diagnostic pull request parameter used. + /// + [DataContract] + public class VSInternalDiagnosticParams + { + /// + /// Gets or sets the document for which diagnostics are desired. + /// + [DataMember(Name = "_vs_textDocument", IsRequired = true)] + public TextDocumentIdentifier? TextDocument { get; set; } + + /// + /// Gets or sets a value indicating what kind of diagnostic this request is querying for. + /// + [DataMember(Name = "_vs_queryingDiagnosticKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDiagnosticKind? QueryingDiagnosticKind { get; set; } + + /// + /// Gets or sets the server-generated version number for the diagnostics. + /// + /// + /// + /// This is treated as a black box by the client: it is stored on the client + /// for each textDocument and sent back to the server when requesting + /// diagnostics. The server can use this result ID to avoid resending + /// diagnostics that had previously been sent. + /// + /// Note that if a client does request diagnostics that haven’t changed, the + /// language server should not reply with any diagnostics for that document. + /// If the client requests diagnostics for a file that has been renamed or + /// deleted, then the language service should respond with null for the + /// diagnostics. + /// Also, if a service is reporting multiple DiagnosticReports for the same + /// document, then all reports are expected to have the same + /// previousResultId. + /// + [DataMember(Name = "_vs_previousResultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? PreviousResultId { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs new file mode 100644 index 0000000000000..4c7adadb213d0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDiagnosticReport.cs @@ -0,0 +1,77 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a diagnostic pull request report. + /// + [DataContract] + public class VSInternalDiagnosticReport + { + /// + /// Gets or sets the server-generated version number for the diagnostics. + /// This is treated as a black box by the client: it is stored on the client + /// for each textDocument and sent back to the server when requesting + /// diagnostics.The server can use this result ID to avoid resending + /// diagnostics that had previously been sent. + /// + [DataMember(Name = "_vs_resultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ResultId { get; set; } + + /// + /// Gets or sets a (potentially incomplete) list of Diagnostics for the document. + /// Subsequent DiagnosticReports for the same document will be appended. + /// + /// + /// Is null if no changes in the diagnostics. Is empty if there is no diagnostic. + /// + [DataMember(Name = "_vs_diagnostics")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Diagnostic[]? Diagnostics { get; set; } + + /// + /// Gets or sets an identifier associated with all the diagnostics in this report. + /// + /// If the property matches the supersedes property of another report, + /// entries tagged with will + /// be hidden in the editor. + /// + [DataMember(Name = "_vs_identifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? Identifier { get; set; } + + /// + /// Gets or sets an indicator of which diagnostic report is superseded by this report. + /// + /// + /// Diagnostics in a superseded report will be hidden if they have the PotentialDuplicate VSDiagnosticTag. + /// + [DataMember(Name = "_vs_supersedes")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? Supersedes { get; set; } + + /// + /// Gets or sets an optional key used to associate diagnostics with lines + /// of text in the output window(diagnostics can have an additional + /// outputId and the (outputKey, outputId) uniquely identify + /// a line of text in the output window). + /// + [DataMember(Name = "_vs_outputKey")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Guid? OutputKey { get; set; } + + /// + /// Gets or sets the document version. + /// + [DataMember(Name = "_vs_version")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? Version { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs new file mode 100644 index 0000000000000..e34d677498bc8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalDocumentDiagnosticsParams.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a diagnostic pull request for a specific document. + /// + [DataContract] + public class VSInternalDocumentDiagnosticsParams : VSInternalDiagnosticParams, IPartialResultParams + { + /// + /// Gets or sets an optional token that a server can use to report work done progress. + /// + [DataMember(Name = Methods.WorkDoneTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? WorkDoneToken { get; set; } + + /// + /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client. + /// + [DataMember(Name = Methods.PartialResultTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs new file mode 100644 index 0000000000000..a99f88a28ae33 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticReport.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing a diagnostic pull request result for all documents. + /// + [DataContract] + public class VSInternalWorkspaceDiagnosticReport : VSInternalDiagnosticReport + { + /// + /// Gets or sets the document for which diagnostics is returned. + /// + [DataMember(Name = "_vs_textDocument", IsRequired = true)] + public TextDocumentIdentifier? TextDocument { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs new file mode 100644 index 0000000000000..e5dca84498a59 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Diagnostics/VSInternalWorkspaceDiagnosticsParams.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a diagnostic pull request for all documents. + /// + [DataContract] + public class VSInternalWorkspaceDiagnosticsParams : IPartialResultParams + { + /// + /// Gets or sets the current state of the documents the client already has received. + /// + [DataMember(Name = "_vs_previousResults")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDiagnosticParams[]? PreviousResults { get; set; } + + /// + /// Gets or sets an optional token that a server can use to report work done progress. + /// + [DataMember(Name = Methods.WorkDoneTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? WorkDoneToken { get; set; } + + /// + /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client. + /// + [DataMember(Name = Methods.PartialResultTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken { get; set; } + + /// + /// Gets or sets a value indicating what kind of diagnostic this request is querying for. + /// + [DataMember(Name = "_vs_queryingDiagnosticKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDiagnosticKind? QueryingDiagnosticKind { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs new file mode 100644 index 0000000000000..ed7443a91576b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionList.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A subclass of the VS LSP protocol extension that has a fast serialization path. + /// + [DataContract] + [JsonConverter(typeof(OptimizedVSCompletionListJsonConverter))] + public sealed class OptimizedVSCompletionList : VSInternalCompletionList + { + /// + /// Initializes a new instance of the class. + /// + /// The completion list to wrap. + public OptimizedVSCompletionList(VSInternalCompletionList completionList) + { + this.Items = completionList.Items; + this.IsIncomplete = completionList.IsIncomplete; + this.SuggestionMode = completionList.SuggestionMode; + this.ContinueCharacters = completionList.ContinueCharacters; + this.Data = completionList.Data; + this.CommitCharacters = completionList.CommitCharacters; + this.ItemDefaults = completionList.ItemDefaults; + } + + /// + /// Initializes a new instance of the class. + /// + /// The completion list to wrap. + public OptimizedVSCompletionList(CompletionList completionList) + { + this.Items = completionList.Items; + this.IsIncomplete = completionList.IsIncomplete; + this.ItemDefaults = completionList.ItemDefaults; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs new file mode 100644 index 0000000000000..45b225fa22e8f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Efficiency/OptimizedVSCompletionListJsonConverter.cs @@ -0,0 +1,267 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using Roslyn.Core.Imaging; + using Newtonsoft.Json; + + internal class OptimizedVSCompletionListJsonConverter : JsonConverter + { + public static readonly OptimizedVSCompletionListJsonConverter Instance = new OptimizedVSCompletionListJsonConverter(); + private static readonly ConcurrentDictionary IconRawJson = new ConcurrentDictionary(); + + public override bool CanRead => false; + + public override bool CanConvert(Type objectType) => typeof(OptimizedVSCompletionList) == objectType; + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) => throw new NotImplementedException(); + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is null) + { + writer.WriteNull(); + return; + } + + VSInternalCompletionList completionList = (VSInternalCompletionList)value; + + writer.WriteStartObject(); + + if (completionList.SuggestionMode) + { + writer.WritePropertyName(VSInternalCompletionList.SuggestionModeSerializedName); + writer.WriteValue(completionList.SuggestionMode); + } + else + { + // Default is "false" so no need to serialize + } + + if (completionList.ContinueCharacters != null && completionList.ContinueCharacters.Length > 0) + { + writer.WritePropertyName(VSInternalCompletionList.ContinueCharactersSerializedName); + serializer.Serialize(writer, completionList.ContinueCharacters); + } + + if (completionList.Data != null) + { + writer.WritePropertyName(VSInternalCompletionList.DataSerializedName); + serializer.Serialize(writer, completionList.Data); + } + + if (completionList.CommitCharacters != null) + { + writer.WritePropertyName(VSInternalCompletionList.CommitCharactersSerializedName); + serializer.Serialize(writer, completionList.CommitCharacters); + } + + if (completionList.IsIncomplete) + { + writer.WritePropertyName("isIncomplete"); + writer.WriteValue(completionList.IsIncomplete); + } + else + { + // Default is "false" so no need to serialize + } + + writer.WritePropertyName("items"); + if (completionList.Items == null || completionList.Items.Length == 0) + { + writer.WriteRawValue("[]"); + } + else + { + writer.WriteStartArray(); + + var itemRawJsonCache = new Dictionary(capacity: 1); + + foreach (CompletionItem completionItem in completionList.Items) + { + if (completionItem == null) + { + continue; + } + + this.WriteCompletionItem(writer, completionItem, serializer, itemRawJsonCache); + } + + writer.WriteEndArray(); + } + + if (completionList.ItemDefaults != null) + { + writer.WritePropertyName("itemDefaults"); + serializer.Serialize(writer, completionList.ItemDefaults); + } + + writer.WriteEndObject(); + } + + private void WriteCompletionItem(JsonWriter writer, CompletionItem completionItem, JsonSerializer serializer, Dictionary itemRawJsonCache) + { + writer.WriteStartObject(); + + if (completionItem is VSInternalCompletionItem vsCompletionItem) + { + if (vsCompletionItem.Icon != null) + { + if (!IconRawJson.TryGetValue(vsCompletionItem.Icon.ImageId, out string jsonString)) + { + jsonString = JsonConvert.SerializeObject(vsCompletionItem.Icon, Formatting.None, ImageElementConverter.Instance); + IconRawJson.TryAdd(vsCompletionItem.Icon.ImageId, jsonString); + } + + writer.WritePropertyName(VSInternalCompletionItem.IconSerializedName); + writer.WriteRawValue(jsonString); + } + + if (vsCompletionItem.Description != null) + { + writer.WritePropertyName(VSInternalCompletionItem.DescriptionSerializedName); + ClassifiedTextElementConverter.Instance.WriteJson(writer, vsCompletionItem.Description, serializer); + } + + if (vsCompletionItem.VsCommitCharacters?.Value is string[] basicCommitCharacters + && basicCommitCharacters.Length > 0) + { + if (!itemRawJsonCache.TryGetValue(basicCommitCharacters, out string jsonString)) + { + jsonString = JsonConvert.SerializeObject(basicCommitCharacters); + itemRawJsonCache.Add(basicCommitCharacters, jsonString); + } + + writer.WritePropertyName(VSInternalCompletionItem.VsCommitCharactersSerializedName); + writer.WriteRawValue(jsonString); + } + else if (vsCompletionItem.VsCommitCharacters?.Value is VSInternalCommitCharacter[] augmentedCommitCharacters + && augmentedCommitCharacters.Length > 0) + { + if (!itemRawJsonCache.TryGetValue(augmentedCommitCharacters, out string jsonString)) + { + jsonString = JsonConvert.SerializeObject(augmentedCommitCharacters); + itemRawJsonCache.Add(augmentedCommitCharacters, jsonString); + } + + writer.WritePropertyName(VSInternalCompletionItem.VsCommitCharactersSerializedName); + writer.WriteRawValue(jsonString); + } + + if (vsCompletionItem.VsResolveTextEditOnCommit) + { + writer.WritePropertyName(VSInternalCompletionItem.VsResolveTextEditOnCommitName); + writer.WriteValue(vsCompletionItem.VsResolveTextEditOnCommit); + } + } + + string label = completionItem.Label; + if (label != null) + { + writer.WritePropertyName("label"); + writer.WriteValue(label); + } + + if (completionItem.LabelDetails != null) + { + writer.WritePropertyName("labelDetails"); + serializer.Serialize(writer, completionItem.LabelDetails); + } + + writer.WritePropertyName("kind"); + writer.WriteValue(completionItem.Kind); + + if (completionItem.Detail != null) + { + writer.WritePropertyName("detail"); + writer.WriteValue(completionItem.Detail); + } + + if (completionItem.Documentation != null) + { + writer.WritePropertyName("documentation"); + serializer.Serialize(writer, completionItem.Documentation); + } + + // Only render preselect if it's "true" + if (completionItem.Preselect) + { + writer.WritePropertyName("preselect"); + writer.WriteValue(completionItem.Preselect); + } + + if (completionItem.SortText != null && !string.Equals(completionItem.SortText, label, StringComparison.Ordinal)) + { + writer.WritePropertyName("sortText"); + writer.WriteValue(completionItem.SortText); + } + + if (completionItem.FilterText != null && !string.Equals(completionItem.FilterText, label, StringComparison.Ordinal)) + { + writer.WritePropertyName("filterText"); + writer.WriteValue(completionItem.FilterText); + } + + if (completionItem.InsertText != null && !string.Equals(completionItem.InsertText, label, StringComparison.Ordinal)) + { + writer.WritePropertyName("insertText"); + writer.WriteValue(completionItem.InsertText); + } + + if (completionItem.InsertTextFormat != default && completionItem.InsertTextFormat != InsertTextFormat.Plaintext) + { + writer.WritePropertyName("insertTextFormat"); + writer.WriteValue(completionItem.InsertTextFormat); + } + + if (completionItem.TextEdit != null) + { + writer.WritePropertyName("textEdit"); + serializer.Serialize(writer, completionItem.TextEdit); + } + + if (completionItem.TextEditText != null) + { + writer.WritePropertyName("textEditText"); + serializer.Serialize(writer, completionItem.TextEditText); + } + + if (completionItem.AdditionalTextEdits != null && completionItem.AdditionalTextEdits.Length > 0) + { + writer.WritePropertyName("additionalTextEdits"); + serializer.Serialize(writer, completionItem.AdditionalTextEdits); + } + + if (completionItem.CommitCharacters != null && completionItem.CommitCharacters.Length > 0) + { + if (!itemRawJsonCache.TryGetValue(completionItem.CommitCharacters, out string jsonString)) + { + jsonString = JsonConvert.SerializeObject(completionItem.CommitCharacters); + itemRawJsonCache.Add(completionItem.CommitCharacters, jsonString); + } + + writer.WritePropertyName("commitCharacters"); + writer.WriteRawValue(jsonString); + } + + if (completionItem.Command != null) + { + writer.WritePropertyName("command"); + serializer.Serialize(writer, completionItem.Command); + } + + if (completionItem.Data != null) + { + writer.WritePropertyName("data"); + serializer.Serialize(writer, completionItem.Data); + } + + writer.WriteEndObject(); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextElement.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextElement.cs new file mode 100644 index 0000000000000..01d0622a300a6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextElement.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using Roslyn.Text.Adornments; + +namespace Roslyn.Text.Adornments +{ + public sealed class ClassifiedTextElement + { + public const string TextClassificationTypeName = "text"; + + public IEnumerable Runs { get; } + + public ClassifiedTextElement(params ClassifiedTextRun[] runs) + { + Runs = runs?.ToImmutableList() ?? throw new ArgumentNullException("runs"); + } + + public ClassifiedTextElement(IEnumerable runs) + { + Runs = runs?.ToImmutableList() ?? throw new ArgumentNullException("runs"); + } + + public static ClassifiedTextElement CreateHyperlink(string text, string tooltip, Action navigationAction) + { + //Requires.NotNull(text, "text"); + //Requires.NotNull(navigationAction, "navigationAction"); + return new ClassifiedTextElement(new ClassifiedTextRun("text", text, navigationAction, tooltip)); + } + + public static ClassifiedTextElement CreatePlainText(string text) + { + //Requires.NotNull(text, "text"); + return new ClassifiedTextElement(new ClassifiedTextRun("text", text, ClassifiedTextRunStyle.Plain)); + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRun.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRun.cs new file mode 100644 index 0000000000000..04d206a1caf91 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRun.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +using System; + +namespace Roslyn.Text.Adornments +{ + public sealed class ClassifiedTextRun + { + public string ClassificationTypeName { get; } + + public string Text { get; } + + public string MarkerTagType { get; } + + public ClassifiedTextRunStyle Style { get; } + + public string Tooltip { get; } + + public Action NavigationAction { get; } + + public ClassifiedTextRun(string classificationTypeName, string text) + : this(classificationTypeName, text, ClassifiedTextRunStyle.Plain) + { + } + + public ClassifiedTextRun(string classificationTypeName, string text, ClassifiedTextRunStyle style) + { + ClassificationTypeName = classificationTypeName ?? throw new ArgumentNullException("classificationTypeName"); + Text = text ?? throw new ArgumentNullException("text"); + Style = style; + } + + public ClassifiedTextRun(string classificationTypeName, string text, ClassifiedTextRunStyle style, string markerTagType) + { + ClassificationTypeName = classificationTypeName ?? throw new ArgumentNullException("classificationTypeName"); + Text = text ?? throw new ArgumentNullException("text"); + MarkerTagType = markerTagType; + Style = style; + } + + public ClassifiedTextRun(string classificationTypeName, string text, Action navigationAction, string tooltip = null, ClassifiedTextRunStyle style = ClassifiedTextRunStyle.Plain) + { + ClassificationTypeName = classificationTypeName ?? throw new ArgumentNullException("classificationTypeName"); + Text = text ?? throw new ArgumentNullException("text"); + Style = style; + NavigationAction = navigationAction ?? throw new ArgumentNullException("navigationAction"); + Tooltip = tooltip; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRunStyle.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRunStyle.cs new file mode 100644 index 0000000000000..bf89a8101a38e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ClassifiedTextRunStyle.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Roslyn.Text.Adornments +{ + // + // Summary: + // The text style for a Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRun. + // + // Remarks: + // By default, text is displayed using tooltip preferences, but colorized using + // text editor colors in order to make tooltips that look visually like UI, but + // match the semantic colorization of the code. + [Flags] + public enum ClassifiedTextRunStyle + { + // + // Summary: + // Plain text. + Plain = 0x0, + // + // Summary: + // Bolded text. + Bold = 0x1, + // + // Summary: + // Italic text. + Italic = 0x2, + // + // Summary: + // Underlined text. + Underline = 0x4, + // + // Summary: + // Use the font specified by the classification. + // + // Remarks: + // If applied, the classification's code font is used instead of the default tooltip + // font. + UseClassificationFont = 0x8, + // + // Summary: + // Use the style specified by the classification. + // + // Remarks: + // If applied, the classification's bold, italic, and underline settings are used + // instead of the default tooltip style. Note that additional styles can be layered + // on top of the classification's style by adding Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Bold, + // Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Italic, or Microsoft.VisualStudio.Text.Adornments.ClassifiedTextRunStyle.Underline. + UseClassificationStyle = 0x10 + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElement.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElement.cs new file mode 100644 index 0000000000000..36c29faecbbd6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElement.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; + +namespace Roslyn.Text.Adornments +{ + public sealed class ContainerElement + { + public IEnumerable Elements { get; } + + public ContainerElementStyle Style { get; } + + public ContainerElement(ContainerElementStyle style, IEnumerable elements) + { + Style = style; + Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException("elements"); + } + + public ContainerElement(ContainerElementStyle style, params object[] elements) + { + Style = style; + Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException("elements"); + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElementStyle.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElementStyle.cs new file mode 100644 index 0000000000000..57642dde3553b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ContainerElementStyle.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Roslyn.Text.Adornments +{ + // + // Summary: + // The layout style for a Microsoft.VisualStudio.Text.Adornments.ContainerElement. + [Flags] + public enum ContainerElementStyle + { + // + // Summary: + // Contents are end-to-end, and wrapped when the control becomes too wide. + Wrapped = 0x0, + // + // Summary: + // Contents are stacked vertically. + Stacked = 0x1, + // + // Summary: + // Additional padding above and below content. + VerticalPadding = 0x2 + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageElement.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageElement.cs new file mode 100644 index 0000000000000..a4b71b9afdfe9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageElement.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Roslyn.Core.Imaging; + +namespace Roslyn.Text.Adornments +{ + public class ImageElement + { + public static readonly ImageElement Empty = new ImageElement(default(ImageId), string.Empty); + + public ImageId ImageId { get; } + + public string AutomationName { get; } + + public ImageElement(ImageId imageId) + { + ImageId = imageId; + } + + public ImageElement(ImageId imageId, string automationName) + : this(imageId) + { + AutomationName = automationName ?? throw new ArgumentNullException("automationName"); + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageId.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageId.cs new file mode 100644 index 0000000000000..0956b8ad73a84 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/Text/ImageId.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; + +namespace Roslyn.Core.Imaging +{ + // + // Summary: + // Unique identifier for Visual Studio image asset. + // + // Remarks: + // On Windows systems, Microsoft.VisualStudio.Core.Imaging.ImageId can be converted + // to and from various other image representations via the ImageIdExtensions extension + // methods. + public struct ImageId : IEquatable + { + // + // Summary: + // The Microsoft.VisualStudio.Core.Imaging.ImageId.Guid identifying the group to + // which this image belongs. + public readonly Guid Guid; + + // + // Summary: + // The System.Int32 identifying the particular image from the group that this id + // maps to. + public readonly int Id; + + // + // Summary: + // Creates a new instance of ImageId. + // + // Parameters: + // guid: + // The Microsoft.VisualStudio.Core.Imaging.ImageId.Guid identifying the group to + // which this image belongs. + // + // id: + // The System.Int32 identifying the particular image from the group that this id + // maps to. + public ImageId(Guid guid, int id) + { + Guid = guid; + Id = id; + } + + public override string ToString() + { + return ToString(CultureInfo.InvariantCulture); + } + + public string ToString(IFormatProvider provider) + { + Guid guid = Guid; + string arg = guid.ToString("D", provider); + int id = Id; + return string.Format(provider, "{0} : {1}", arg, id.ToString(provider)); + } + + bool IEquatable.Equals(ImageId other) + { + int id = Id; + if (id.Equals(other.Id)) + { + Guid guid = Guid; + return guid.Equals(other.Guid); + } + + return false; + } + + public override bool Equals(object other) + { + if (other is ImageId) + { + ImageId other2 = (ImageId)other; + return ((IEquatable)this).Equals(other2); + } + + return false; + } + + public static bool operator ==(ImageId left, ImageId right) + { + return left.Equals(right); + } + + public static bool operator !=(ImageId left, ImageId right) + { + return !(left == right); + } + + public override int GetHashCode() + { + Guid guid = Guid; + int hashCode = guid.GetHashCode(); + int id = Id; + return hashCode ^ id.GetHashCode(); + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSFoldingRangeSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSFoldingRangeSetting.cs new file mode 100644 index 0000000000000..07708a83b398c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSFoldingRangeSetting.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class used to extend to add internal capabilities. + /// + public class VSFoldingRangeSetting : FoldingRangeSetting + { + /// + /// Gets or sets a value indicating whether if client only supports entire line folding only. + /// + [DataMember(Name = "_vs_refreshSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RefreshSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClientCapabilities.cs new file mode 100644 index 0000000000000..f4c51ec0c7cde --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClientCapabilities.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Extension class for ClientCapabilities with fields specific to Visual Studio. + /// + [DataContract] + public class VSInternalClientCapabilities : ClientCapabilities + { + /// + /// Gets or sets a value indicating whether client supports Visual Studio extensions. + /// + [DataMember(Name = "_vs_supportsVisualStudioExtensions")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsVisualStudioExtensions + { + get; + set; + } + + /// + /// Gets or sets a value indicating what level of snippet support is available from Visual Studio Client. + /// v1.0 refers to only default tab stop support i.e. support for $0 which manipualtes the cursor position. + /// + [DataMember(Name = "_vs_supportedSnippetVersion")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalSnippetSupportLevel? SupportedSnippetVersion + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether client supports omitting document text in textDocument/didOpen notifications. + /// + [DataMember(Name = "_vs_supportsNotIncludingTextInTextDocumentDidOpen")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsNotIncludingTextInTextDocumentDidOpen + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client supports string based response kinds + /// instead of enum based response kinds. + /// + [DataMember(Name = "_vs_supportsIconExtensions")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsIconExtensions + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client provides support for diagnostic pull requests. + /// + [DataMember(Name = "_vs_supportsDiagnosticRequests")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsDiagnosticRequests + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClipboardContent.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClipboardContent.cs new file mode 100644 index 0000000000000..34cf34145761e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalClipboardContent.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents content to be sent to the clipboard. + /// + [DataContract] + public class VSInternalClipboardContent + { + /// + /// Gets or sets a string that describes clipboard format types, for example, "text/plain". + /// + [DataMember(Name = "_vs_mime", IsRequired = true)] + public string MimeType + { + get; + set; + } + + /// + /// Gets or sets the content of the clipboard. + /// + [DataMember(Name = "_vs_content", IsRequired = true)] + public string Content + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeAction.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeAction.cs new file mode 100644 index 0000000000000..e915eb10f1676 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeAction.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class used to extend to add the data field for codeAction/_ms_resolve support. + /// + [DataContract] + public class VSInternalCodeAction : CodeAction + { + /// + /// Gets or sets the group this CodeAction belongs to. + /// + [DataMember(Name = "_vs_group")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Group + { + get; + set; + } + + /// + /// Gets or sets the priority level of the code action. + /// + [DataMember(Name = "_vs_priority")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalPriorityLevel? Priority + { + get; + set; + } + + /// + /// Gets or sets the range of the span this action is applicable to. + /// + [DataMember(Name = "_vs_applicableRange")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Range? ApplicableRange + { + get; + set; + } + + /// + /// Gets or sets the children of this action. + /// + [DataMember(Name = "_vs_children")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalCodeAction[]? Children + { + get; + set; + } + + /// + /// Gets or sets the telemetry id of this action. + /// + [DataMember(Name = "_vs_telemetryId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Guid? TelemetryId + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionContext.cs new file mode 100644 index 0000000000000..27ea7f79339f6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionContext.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent from the client to the server for the textDocument/codeAction request. + /// + [DataContract] + public class VSInternalCodeActionContext : CodeActionContext + { + /// + /// Gets or sets the range of the current selection in the document for which the command was invoked. + /// If there is no selection this would be a Zero-length range for the caret position. + /// + [DataMember(Name = "_vs_selectionRange")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Range? SelectionRange + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroup.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroup.cs new file mode 100644 index 0000000000000..66f0306ccbf19 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroup.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum which represents the various kinds of code actions. + /// + public static class VSInternalCodeActionGroup + { + /// + /// Code action is a quick fix. + /// + public const string QuickFix = "quickfix"; + + /// + /// Code action is a refactor. + /// + public const string Refactor = "refactor"; + + /// + /// Code action is a refactor for extracting methods, functions, variables, etc. + /// + public const string RefactorExtract = "refactor.extract"; + + /// + /// Code action is a refactor for inlining methods, constants, etc. + /// + public const string RefactorInline = "refactor.inline"; + + /// + /// Code action is a refactor for rewrite actions, such as making methods static. + /// + public const string RefactorRewrite = "refactor.rewrite"; + + /// + /// Code action applies to the entire file. + /// + public const string Source = "source"; + + /// + /// Code actions is for organizing imports. + /// + public const string SourceOrganizeImports = "source.organizeImports"; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroupSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroupSetting.cs new file mode 100644 index 0000000000000..0448b15f9bfeb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionGroupSetting.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class containing the set of code action default groups that are supported. + /// + [DataContract] + public class VSInternalCodeActionGroupSetting + { + /// + /// Gets or sets the code actions default group names the client supports. + /// + [DataMember(Name = "_vs_valueSet")] + public string[] ValueSet + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs new file mode 100644 index 0000000000000..38bcc874b8073 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCodeActionLiteralSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing support for code action literals. + /// + [DataContract] + public class VSInternalCodeActionLiteralSetting : CodeActionLiteralSetting + { + /// + /// Gets or sets a value indicating what code action default groups are supported. + /// + [DataMember(Name = "_vs_codeActionGroup")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalCodeActionGroupSetting? CodeActionGroup + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCommitCharacter.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCommitCharacter.cs new file mode 100644 index 0000000000000..e61d76e1631d9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCommitCharacter.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Extension class for CompletionItem with fields specific to Visual Studio functionalities. + /// + [DataContract] + public class VSInternalCommitCharacter + { + /// + /// Gets or sets the commit character. + /// + [DataMember(Name = "_vs_character")] + public string Character { get; set; } + + /// + /// Gets or sets a value indicating whether the commit character should be inserted or not. + /// + [DataMember(Name = "_vs_insert")] + public bool Insert { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionContext.cs new file mode 100644 index 0000000000000..5a74b56fb3d77 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionContext.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Extension class for with properties specific to Visual Studio. + /// + [DataContract] + public class VSInternalCompletionContext : CompletionContext + { + /// + /// Gets or sets the indicating how the completion was triggered. + /// + [DataMember(Name = "_vs_invokeKind")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + [DefaultValue(VSInternalCompletionInvokeKind.Explicit)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public VSInternalCompletionInvokeKind InvokeKind + { + get; + set; + } = VSInternalCompletionInvokeKind.Explicit; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionInvokeKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionInvokeKind.cs new file mode 100644 index 0000000000000..124fb40591337 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionInvokeKind.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Provides value for which specifies + /// how completion was invoked. + /// + [DataContract] + public enum VSInternalCompletionInvokeKind + { + /// + /// Completion was triggered by explicit user's gesture (e.g. Ctrl+Space, Ctr+J) or via API. + /// + Explicit = 0, + + /// + /// Completion was triggered by typing an identifier. + /// + Typing = 1, + + /// + /// Completion was triggered by deletion (e.g. Backspace or Delete keys). + /// + Deletion = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionItem.cs new file mode 100644 index 0000000000000..a9cf98cb16c4c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionItem.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Roslyn.Text.Adornments; + using Newtonsoft.Json; + + /// + /// Extension class for CompletionItem with fields specific to Visual Studio functionalities. + /// + [DataContract] + public class VSInternalCompletionItem : CompletionItem + { + internal const string IconSerializedName = "_vs_icon"; + internal const string DescriptionSerializedName = "_vs_description"; + internal const string VsCommitCharactersSerializedName = "_vs_commitCharacters"; + internal const string VsResolveTextEditOnCommitName = "_vs_resolveTextEditOnCommit"; + + /// + /// Gets or sets the icon to show for the completion item. In VS, this is more extensive than the completion kind. + /// + [DataMember(Name = IconSerializedName)] + [JsonConverter(typeof(ImageElementConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ImageElement? Icon { get; set; } + + /// + /// Gets or sets the description for a completion item. + /// + [DataMember(Name = DescriptionSerializedName)] + [JsonConverter(typeof(ClassifiedTextElementConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ClassifiedTextElement? Description { get; set; } + + /// + /// Gets or sets the set of characters that will commit completion when this is selected. + /// Allows customization of commit behavior. + /// If present, client will use this value instead of . + /// If absent, client will default to . + /// + [DataMember(Name = VsCommitCharactersSerializedName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? VsCommitCharacters { get; set; } + + /// + /// Gets or sets a value indicating whether the client should call to + /// get the value of the text edit to commit. + /// + [DataMember(Name = VsResolveTextEditOnCommitName)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool VsResolveTextEditOnCommit { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionList.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionList.cs new file mode 100644 index 0000000000000..00b238bc11ca9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionList.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A subclass of the LSP protocol that contains extensions specific to Visual Studio. + /// + [DataContract] + public class VSInternalCompletionList : CompletionList + { + internal const string SuggestionModeSerializedName = "_vs_suggestionMode"; + internal const string ContinueCharactersSerializedName = "_vs_continueCharacters"; + internal const string DataSerializedName = "_vs_data"; + internal const string CommitCharactersSerializedName = "_vs_commitCharacters"; + + /// + /// Gets or sets a value indicating whether the completion list should use suggestion mode. In suggestion mode items are "soft-selected" by default. + /// + [DataMember(Name = SuggestionModeSerializedName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool SuggestionMode + { + get; + set; + } + + /// + /// Gets or sets the continue characters for the completion list. + /// + [DataMember(Name = ContinueCharactersSerializedName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType[]? ContinueCharacters + { + get; + set; + } + + /// + /// Gets or sets the default used for completion items. + /// + [DataMember(Name = DataSerializedName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Data + { + get; + set; + } + + /// + /// Gets or sets the default or used for completion items. + /// + /// + /// If set, overrides . + /// + [DataMember(Name = CommitCharactersSerializedName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? CommitCharacters { get; set; } + + // NOTE: Any changes that are added to this file may need to be reflected in its "optimized" counterparts JsonConverter (OptomizedVSCompletionListJsonConverter). + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionListSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionListSetting.cs new file mode 100644 index 0000000000000..8cb032e1bd14b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionListSetting.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents initialization setting for completion list. + /// + [DataContract] + public class VSInternalCompletionListSetting + { + /// + /// Gets or sets a value indicating whether completion lists can have Data bags. These data bags get propagated + /// onto underlying completion items unless they have their own data bags. + /// + [DataMember(Name = "_vs_data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool Data + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether completion lists can have VSCommitCharacters. These commit characters get propagated + /// onto underlying valid completion items unless they have their own commit characters. + /// + [DataMember(Name = "_vs_commitCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public bool CommitCharacters + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionSetting.cs new file mode 100644 index 0000000000000..d04db65ff9759 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalCompletionSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents initialization setting for VS completion. + /// + [DataContract] + public class VSInternalCompletionSetting : CompletionSetting + { + /// + /// Gets or sets completion list setting. + /// + [DataMember(Name = "_vs_completionList")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalCompletionListSetting? CompletionList + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterClass.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterClass.cs new file mode 100644 index 0000000000000..7158233586ae0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterClass.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a unicode character class for completion continuation. + /// + [DataContract] + public class VSInternalContinueCharacterClass + { + /// + /// Gets the type value. + /// + [DataMember(Name = "_vs_type")] + [JsonProperty(Required = Required.Always)] + public const string Type = "unicodeClass"; + + /// + /// Gets or sets the unicode class. + /// + [DataMember(Name = "_vs_unicodeClass")] + [JsonProperty(Required = Required.Always)] + public string UnicodeClass { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterRange.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterRange.cs new file mode 100644 index 0000000000000..28a78e035e042 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterRange.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing range of characters for completion continuation. + /// + [DataContract] + public class VSInternalContinueCharacterRange + { + /// + /// Gets the type value. + /// + [DataMember(Name = "_vs_type")] + [JsonProperty(Required = Required.Always)] + public const string Type = "charRange"; + + /// + /// Gets or sets the first completion character of the range. + /// + [DataMember(Name = "_vs_start")] + [JsonProperty(Required = Required.Always)] + public string Start { get; set; } + + /// + /// Gets or sets the last completion character of the range. + /// + [DataMember(Name = "_vs_end")] + [JsonProperty(Required = Required.Always)] + public string End { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterSingle.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterSingle.cs new file mode 100644 index 0000000000000..a516776fbce68 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalContinueCharacterSingle.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing single continue character for completion. + /// + [DataContract] + public class VSInternalContinueCharacterSingle + { + /// + /// Gets the type value. + /// + [DataMember(Name = "_vs_type")] + [JsonProperty(Required = Required.Always)] + public const string Type = "singleChar"; + + /// + /// Gets or sets the completion character. + /// + [DataMember(Name = "_vs_char")] + [JsonProperty(Required = Required.Always)] + public string Character { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs new file mode 100644 index 0000000000000..b29ae64ad5bf2 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertOptions.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the options for on auto insert. + /// + [DataContract] + public class VSInternalDocumentOnAutoInsertOptions + { + /// + /// Gets or sets trigger characters for on auto insert. + /// + [DataMember(Name = "_vs_triggerCharacters")] + public string[] TriggerCharacters + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs new file mode 100644 index 0000000000000..e629d8a6c8b7d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertParams.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for a textDocument/_ms_onAutoInsert request. + /// + [DataContract] + public class VSInternalDocumentOnAutoInsertParams : ITextDocumentPositionParams + { + /// + /// Gets or sets the representing the document to format. + /// + [DataMember(Name = "_vs_textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the at which the request was sent. + /// + [DataMember(Name = "_vs_position")] + public Position Position + { + get; + set; + } + + /// + /// Gets or sets the character that was typed. + /// + [DataMember(Name = "_vs_ch")] + public string Character + { + get; + set; + } + + /// + /// Gets or sets the for the request. + /// + [DataMember(Name = "_vs_options")] + public FormattingOptions Options + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs new file mode 100644 index 0000000000000..9fb453b359af3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentOnAutoInsertResponseItem.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the response of an AutoInsert response. + /// + [DataContract] + public class VSInternalDocumentOnAutoInsertResponseItem + { + /// + /// Gets or sets the insert text format of the primary text edit. for supported formats. + /// + [DataMember(Name = "_vs_textEditFormat")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + [DefaultValue(InsertTextFormat.Plaintext)] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + public InsertTextFormat TextEditFormat + { + get; + set; + } = InsertTextFormat.Plaintext; + + /// + /// Gets or sets the text edit. + /// + [DataMember(Name = "_vs_textEdit")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public TextEdit TextEdit + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs new file mode 100644 index 0000000000000..f3542b739c7b3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalDocumentSpellCheckableParams.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using System.Text; + using Newtonsoft.Json; + + /// + /// Parameter for tD/_vs_spellCheckableRanges. + /// + [DataContract] + public class VSInternalDocumentSpellCheckableParams : VSInternalStreamingParams, IPartialResultParams + { + /// + /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client. + /// + [DataMember(Name = Methods.PartialResultTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs new file mode 100644 index 0000000000000..ab825635c759c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalExecuteCommandClientCapabilities.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing settings for well-known Visual Studio's code action command. + /// + [DataContract] + public class VSInternalExecuteCommandClientCapabilities : DynamicRegistrationSetting + { + /// + /// Initializes a new instance of the class. + /// + public VSInternalExecuteCommandClientCapabilities() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Value indicating whether the setting can be dynamically registered. + public VSInternalExecuteCommandClientCapabilities(bool value) + : base(value) + { + } + + /// + /// Gets or sets a set of well-known commands name the given VS-LSP client supports. + /// + [DataMember(Name = "_vs_supportedCommands")] + public string[] SupportedCommands + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalHover.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalHover.cs new file mode 100644 index 0000000000000..fe2e6e0a7b08f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalHover.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Extension to Hover which adds additional data for colorization. + /// + public class VSInternalHover : Hover + { + /// + /// Gets or sets the value which represents the hover content as a tree + /// of objects from the Microsoft.VisualStudio.Text.Adornments namespace, + /// such as ContainerElements, ClassifiedTextElements and ClassifiedTextRuns. + /// + [DataMember(Name = "_vs_rawContent")] + [JsonConverter(typeof(ObjectContentConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? RawContent + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalIconMapping.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalIconMapping.cs new file mode 100644 index 0000000000000..e158362d89216 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalIconMapping.cs @@ -0,0 +1,132 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Response class when asking server to resolve the rendering information of a string kind. + /// + [DataContract] + public class VSInternalIconMapping : IEquatable + { + /// + /// Gets or sets the ImageElements for a certain kind. + /// + [DataMember(Name = "_vs_images")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSImageId[]? Images + { + get; + set; + } + + /// + /// Gets or sets the tags for a certain kind. To be used in the absence of ImageIds. + /// + [DataMember(Name = "_vs_tags")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? Tags + { + get; + set; + } + + /// + public override bool Equals(object? obj) + { + return this.Equals(obj as VSInternalIconMapping); + } + + /// + public bool Equals(VSInternalIconMapping? other) + { + if (other == null) + { + return false; + } + + return this.CheckImagesAreEqual(this.Images, other.Images) && this.CheckTagsAreEqual(this.Tags, other.Tags); + } + + /// + public override int GetHashCode() + { + int hashCode = 1825600323; + + if (this.Images != null) + { + for (int i = 0; i < this.Images.Length; i++) + { + hashCode = (hashCode * -1521134295) + this.Images[i].Guid.GetHashCode(); + hashCode = (hashCode * -1521134295) + this.Images[i].Id.GetHashCode(); + } + } + + if (this.Tags != null) + { + for (int i = 0; i < this.Tags.Length; i++) + { + hashCode = (hashCode * -1521134295) + StringComparer.Ordinal.GetHashCode(this.Tags[i]); + } + } + + return hashCode; + } + + private bool CheckImagesAreEqual(VSImageId[]? current, VSImageId[]? other) + { + if (current == null ^ other == null) + { + return false; + } + + if (current != null && + other != null && + current.Length == other.Length) + { + for (int i = 0; i < current.Length; i++) + { + if (current[i].Id != other[i].Id) + { + return false; + } + + if (current[i].Guid != other[i].Guid) + { + return false; + } + } + } + + return true; + } + + private bool CheckTagsAreEqual(string[]? current, string[]? other) + { + if (current == null ^ other == null) + { + return false; + } + + if (current != null && + other != null && + current.Length == other.Length) + { + for (int i = 0; i < current.Length; i++) + { + if (!string.Equals(current[i], other[i], StringComparison.Ordinal)) + { + return false; + } + } + } + + return true; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionContext.cs new file mode 100644 index 0000000000000..4f7657f90ba8a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionContext.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Context for inline completion request. + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L27. + /// + public class VSInternalInlineCompletionContext + { + /// + /// Gets or sets how completion was triggered. + /// + [DataMember(Name = "_vs_triggerKind")] + [JsonProperty(Required = Required.Always)] + public VSInternalInlineCompletionTriggerKind TriggerKind { get; set; } = VSInternalInlineCompletionTriggerKind.Explicit; + + /// + /// Gets or sets information about the currently selected item in the autocomplete widget, if visible. + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L45. + /// + [DataMember(Name = "_vs_selectedCompletionInfo")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public VSInternalSelectedCompletionInfo? SelectedCompletionInfo { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionItem.cs new file mode 100644 index 0000000000000..15a28eb9f62f1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionItem.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// A single inline completion item response. + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L78. + /// + public class VSInternalInlineCompletionItem + { + /// + /// Gets or sets the text to replace the range with. + /// + [DataMember(Name = "_vs_text")] + [JsonProperty(Required = Required.Always)] + public string Text { get; set; } + + /// + /// Gets or sets the range to replace. + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L94. + /// + [DataMember(Name = "_vs_range")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public Range? Range { get; set; } + + /// + /// Gets or sets the command that is executed after inserting this completion item. + /// + [DataMember(Name = "_vs_command")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public Command? Command { get; set; } + + /// + /// Gets or sets the format of the insert text. + /// + [DataMember(Name = "_vs_insertTextFormat")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public InsertTextFormat? TextFormat { get; set; } = InsertTextFormat.Plaintext; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionList.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionList.cs new file mode 100644 index 0000000000000..c2be69d79670b --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionList.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Response for an inline completions request. + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L72. + /// + public class VSInternalInlineCompletionList + { + /// + /// Gets or sets the inline completion items. + /// + [DataMember(Name = "_vs_items")] + [JsonProperty(Required = Required.Always)] + public VSInternalInlineCompletionItem[] Items { get; set; } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionOptions.cs new file mode 100644 index 0000000000000..e2e8d33366155 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionOptions.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using System.Text.RegularExpressions; + + using Newtonsoft.Json; + + /// + /// The options for inline completion. + /// + [DataContract] + public class VSInternalInlineCompletionOptions + { + /// + /// Gets or sets a regex used by the client to determine when to ask the server for snippets. + /// + [DataMember(Name = "_vs_pattern")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + [JsonConverter(typeof(RegexConverter))] + public Regex Pattern { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionRequest.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionRequest.cs new file mode 100644 index 0000000000000..8bf0fe53a9dc5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionRequest.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// The request data for an inline completions request. + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L24. + /// + public class VSInternalInlineCompletionRequest : ITextDocumentParams + { + /// + /// Gets or sets the text document. + /// + [DataMember(Name = "_vs_textDocument")] + [JsonProperty(Required = Required.Always)] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets the position where inline completions are being requested. + /// + [DataMember(Name = "_vs_position")] + [JsonProperty(Required = Required.Always)] + public Position Position { get; set; } + + /// + /// Gets or sets the context for the inline completions request. + /// + [DataMember(Name = "_vs_context")] + [JsonProperty(Required = Required.Always)] + public VSInternalInlineCompletionContext Context { get; set; } + + /// + /// Gets or sets the for the request. + /// + [DataMember(Name = "_vs_options")] + public FormattingOptions Options { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs new file mode 100644 index 0000000000000..5a843d317b7a3 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalInlineCompletionTriggerKind.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// How the inline completion request was triggered. + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L58. + /// + [DataContract] + public enum VSInternalInlineCompletionTriggerKind + { + /// + /// Inline completions were triggered automatically while editing. + /// + Automatic = 0, + + /// + /// Completion was triggered explicitly by a user gesture. + /// + Explicit = 1, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalItemOrigin.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalItemOrigin.cs new file mode 100644 index 0000000000000..d08dad01ebb7d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalItemOrigin.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum which represents the origin of an item. + /// + public enum VSInternalItemOrigin + { + /// + /// The entry is contained in exact code. + /// + Exact = 0, + + /// + /// The entry is contained in metadata generated from exact information. + /// + ExactMetadata = 1000, + + /// + /// The entry is contained in indexed code. + /// + Indexed = 2000, + + /// + /// The entry is contained in indexed code in the repo where the request originated. + /// + IndexedInRepo = 2100, + + /// + /// The entry is contained in indexed code in the same organization but different repo where the request originated. + /// + IndexedInOrganization = 2200, + + /// + /// The entry is contained in indexed code in a different organization and repo where request originated. + /// + IndexedInThirdParty = 2300, + + /// + /// The entry is of lesser quality than all other choices. + /// + Other = int.MaxValue, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKindAndModifier.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKindAndModifier.cs new file mode 100644 index 0000000000000..3a663d1d2d553 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKindAndModifier.cs @@ -0,0 +1,115 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class that contains the base kind and modifiers used to describe a response item. + /// + [DataContract] + public class VSInternalKindAndModifier : IEquatable + { + /// + /// Gets or sets the ImageIds for a certain kind. + /// + [DataMember(Name = "_vs_kind")] + public string Kind + { + get; + set; + } + + /// + /// Gets or sets the modifier of the kind. + /// + [DataMember(Name = "_vs_modifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? Modifier + { + get; + set; + } + + public static bool operator ==(VSInternalKindAndModifier? value1, VSInternalKindAndModifier? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(VSInternalKindAndModifier? value1, VSInternalKindAndModifier? value2) + { + return !(value1 == value2); + } + + /// + public override bool Equals(object obj) + { + return this.Equals(obj as VSInternalKindAndModifier); + } + + /// + public bool Equals(VSInternalKindAndModifier? other) + { + return other != null && + string.Equals(this.Kind, other.Kind, StringComparison.Ordinal) && + this.CheckModifierEquality(other.Modifier); + } + + /// + public override int GetHashCode() + { + int hashCode = 1850642763; + hashCode = (hashCode * -1521134295) + (this.Kind == null ? 0 : StringComparer.Ordinal.GetHashCode(this.Kind)); + if (this.Modifier != null) + { + for (int i = 0; i < this.Modifier.Length; i++) + { + if (this.Modifier[i] != null) + { + hashCode = (hashCode * -1521134295) + StringComparer.Ordinal.GetHashCode(this.Modifier[i]); + } + } + } + + return hashCode; + } + + private bool CheckModifierEquality(string[]? modifiers) + { + if (modifiers == null ^ this.Modifier == null) + { + return false; + } + + if (modifiers != null && + this.Modifier != null && + modifiers.Length == this.Modifier.Length) + { + for (int i = 0; i < modifiers.Length; i++) + { + if (!string.Equals(modifiers[i], this.Modifier[i], StringComparison.Ordinal)) + { + return false; + } + } + } + + return true; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKindModifiers.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKindModifiers.cs new file mode 100644 index 0000000000000..8bd418c39bdd9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKindModifiers.cs @@ -0,0 +1,75 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + + /// + /// Known VS response kind modifiers. + /// + public static class VSInternalKnownKindModifiers + { + /// + /// Response kind modifier string for 'public'. + /// + public const string Public = "public"; + + /// + /// Response kind modifier string for 'private'. + /// + public const string Private = "private"; + + /// + /// Response kind modifier string for 'protected'. + /// + public const string Protected = "protected"; + + /// + /// Response kind modifier string for 'internal'. + /// + public const string Internal = "internal"; + + /// + /// Response kind modifier string for 'sealed'. + /// + public const string Sealed = "sealed"; + + /// + /// Response kind modifier string for 'shortcut'. + /// + public const string Shortcut = "shortcut"; + + /// + /// Response kind modifier string for 'snippet'. + /// + public const string Snippet = "snippet"; + + /// + /// Response kind modifier string for 'friend'. + /// + public const string Friend = "friend"; + + /// + /// Response kind modifier string for 'declaration'. + /// + public const string Declaration = "declaration"; + + /// + /// Collection of known response kind modifier strings. + /// + public static readonly IReadOnlyCollection AllModifiers = new[] + { + Public, + Private, + Protected, + Internal, + Sealed, + Shortcut, + Snippet, + Friend, + Declaration, + }; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKinds.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKinds.cs new file mode 100644 index 0000000000000..7e04af9decf77 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalKnownKinds.cs @@ -0,0 +1,267 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + + /// + /// Known VS response kinds. + /// + public static class VSInternalKnownKinds + { + /// + /// Response kind string for 'text'. + /// + public const string Text = "text"; + + /// + /// Response kind string for 'method'. + /// + public const string Method = "method"; + + /// + /// Response kind string for 'function'. + /// + public const string Function = "function"; + + /// + /// Response kind string for 'constructor'. + /// + public const string Constructor = "constructor"; + + /// + /// Response kind string for 'field'. + /// + public const string Field = "field"; + + /// + /// Response kind string for 'variable'. + /// + public const string Variable = "variable"; + + /// + /// Response kind string for 'class'. + /// + public const string Class = "class"; + + /// + /// Response kind string for 'interface'. + /// + public const string Interface = "interface"; + + /// + /// Response kind string for 'module'. + /// + public const string Module = "module"; + + /// + /// Response kind string for 'property'. + /// + public const string Property = "property"; + + /// + /// Response kind string for 'unit'. + /// + public const string Unit = "unit"; + + /// + /// Response kind string for 'value'. + /// + public const string Value = "value"; + + /// + /// Response kind string for 'enum'. + /// + public const string Enum = "enum"; + + /// + /// Response kind string for 'keyword'. + /// + public const string Keyword = "keyword"; + + /// + /// Response kind string for 'snippet'. + /// + public const string Snippet = "snippet"; + + /// + /// Response kind string for 'color'. + /// + public const string Color = "color"; + + /// + /// Response kind string for 'file'. + /// + public const string File = "file"; + + /// + /// Response kind string for 'reference'. + /// + public const string Reference = "reference"; + + /// + /// Response kind string for 'folder'. + /// + public const string Folder = "folder"; + + /// + /// Response kind string for 'enumMember'. + /// + public const string EnumMember = "enumMember"; + + /// + /// Response kind string for 'constant'. + /// + public const string Constant = "constant"; + + /// + /// Response kind string for 'struct'. + /// + public const string Struct = "struct"; + + /// + /// Response kind string for 'event'. + /// + public const string Event = "event"; + + /// + /// Response kind string for 'operator'. + /// + public const string Operator = "operator"; + + /// + /// Response kind string for 'typeParameter'. + /// + public const string TypeParameter = "typeParameter"; + + /// + /// Response kind string for 'namespace'. + /// + public const string Namespace = "namespace"; + + /// + /// Response kind string for 'package'. + /// + public const string Package = "package"; + + /// + /// Response kind string for 'string'. + /// + public const string StringKind = "string"; + + /// + /// Response kind string for 'number'. + /// + public const string Number = "number"; + + /// + /// Response kind string for 'boolean'. + /// + public const string Boolean = "boolean"; + + /// + /// Response kind string for 'array'. + /// + public const string Array = "array"; + + /// + /// Response kind string for 'object'. + /// + public const string ObjectKind = "object"; + + /// + /// Response kind string for 'key'. + /// + public const string Key = "key"; + + /// + /// Response kind string for 'null'. + /// + public const string Null = "null"; + + /// + /// Response kind string for 'macro'. + /// + public const string Macro = "macro"; + + /// + /// Response kind string for 'template'. + /// + public const string Template = "template"; + + /// + /// Response kind string for 'typedef'. + /// + public const string Typedef = "typedef"; + + /// + /// Response kind string for 'union'. + /// + public const string Union = "union"; + + /// + /// Response kind string for 'delegate'. + /// + public const string Delegate = "delegate"; + + /// + /// Response kind string for 'tag'. + /// + public const string Tag = "tag"; + + /// + /// Response kind string for 'attribute'. + /// + public const string Attribute = "attribute"; + + /// + /// Collection of response kind strings. + /// + public static readonly IReadOnlyCollection AllKinds = new[] + { + Text, + Method, + Function, + Constructor, + Field, + Variable, + Class, + Interface, + Module, + Property, + Unit, + Value, + Enum, + Keyword, + Snippet, + Color, + File, + Reference, + Folder, + EnumMember, + Constant, + Struct, + Event, + Operator, + TypeParameter, + Namespace, + Package, + StringKind, + Number, + Boolean, + Array, + ObjectKind, + Key, + Null, + Macro, + Template, + Typedef, + Union, + Delegate, + Tag, + Attribute, + }; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalLocation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalLocation.cs new file mode 100644 index 0000000000000..534fd1b16ce26 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalLocation.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Roslyn.Text.Adornments; + using Newtonsoft.Json; + + /// + /// Extension class for . Used to relay reference text information with colorization. + /// + [DataContract] + public class VSInternalLocation : VSLocation + { + private object? textValue = null; + + /// + /// Gets or sets the text value for a location reference. Must be of type or or or . + /// + [DataMember(Name = "_vs_text")] + [JsonConverter(typeof(ObjectContentConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Text + { + get + { + return this.textValue; + } + + set + { + if (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string) + { + this.textValue = value; + } + else + { + throw new InvalidOperationException($"{value?.GetType()} is an invalid type."); + } + } + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMethods.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMethods.cs new file mode 100644 index 0000000000000..7fa202964148a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMethods.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class which contains the string values for all Language Server Protocol Visual Studio specific methods. + /// + public static class VSInternalMethods + { + /// + /// Method name for 'textDocument/foldingRange/_vs_refresh'. + /// + public const string DocumentFoldingRangeRefreshName = "textDocument/foldingRange/_vs_refresh"; + + /// + /// Method name for 'textDocument/_vs_references'. + /// + public const string DocumentReferencesName = "textDocument/_vs_references"; + + /// + /// Method name for 'textDocument/_vs_onAutoInsert'. + /// + public const string OnAutoInsertName = "textDocument/_vs_onAutoInsert"; + + /// + /// Method name for 'textDocument/_vs_iconMappingResolve'. + /// + public const string TextDocumentIconMappingResolveName = "textDocument/_vs_iconMappingResolve"; + + /// + /// Method name for 'textdocument/_vs_diagnostic'. + /// + public const string DocumentPullDiagnosticName = "textdocument/_vs_diagnostic"; + + /// + /// Method name for 'workspace/_vs_diagnostic'. + /// + public const string WorkspacePullDiagnosticName = "workspace/_vs_diagnostic"; + + /// + /// Method name for 'textDocument/_vs_validateBreakableRange'. + /// + public const string TextDocumentValidateBreakableRangeName = "textDocument/_vs_validateBreakableRange"; + + /// + /// Method name for 'textDocument/_vs_inlineCompletion'. + /// + public const string TextDocumentInlineCompletionName = "textDocument/_vs_inlineCompletion"; + + /// + /// Method name for 'textDocument/_vs_spellCheckableRanges'. + /// + public const string TextDocumentSpellCheckableRangesName = "textDocument/_vs_spellCheckableRanges"; + + /// + /// Method name for 'textDocument/_vs_uriPresentation'. + /// + public const string TextDocumentUriPresentationName = "textDocument/_vs_uriPresentation"; + + /// + /// Method name for 'textDocument/_vs_textPresentation'. + /// + public const string TextDocumentTextPresentationName = "textDocument/_vs_textPresentation"; + + /// + /// Method name for 'workspace/_vs_spellCheckableRanges'. + /// + public const string WorkspaceSpellCheckableRangesName = "workspace/_vs_spellCheckableRanges"; + + /// + /// Strongly typed message object for 'textDocument/_vs_onAutoInsert'. + /// + public static readonly LspRequest OnAutoInsert = new LspRequest(OnAutoInsertName); + + /// + /// Strongly typed message object for 'textDocument/_vs_iconMappingResolve'. + /// + public static readonly LspRequest TextDocumentIconMappingResolve = new LspRequest(TextDocumentIconMappingResolveName); + + /// + /// Strongly typed message object for 'textDocument/_vs_diagnostic'. + /// + public static readonly LspRequest DocumentPullDiagnostic = new LspRequest(DocumentPullDiagnosticName); + + /// + /// Strongly typed message object for 'workspace/_vs_diagnostic'. + /// + public static readonly LspRequest WorkspacePullDiagnostic = new LspRequest(WorkspacePullDiagnosticName); + + /// + /// Strongly typed message object for 'textDocument/_vs_validateBreakableRange'. + /// + public static readonly LspRequest TextDocumentValidateBreakableRange = new LspRequest(TextDocumentValidateBreakableRangeName); + + /// + /// Strongly typed message object for 'textDocument/inlineCompletion'. + /// + public static readonly LspRequest TextDocumentInlineCompletion = new LspRequest(TextDocumentInlineCompletionName); + + /// + /// Strongly typed message object for 'textDocument/_vs_uriPresentation'. + /// + public static readonly LspRequest TextDocumentUriPresentation = new LspRequest(TextDocumentUriPresentationName); + + /// + /// Strongly typed message object for 'textDocument/_vs_textPresentation'. + /// + public static readonly LspRequest TextDocumentTextPresentation = new LspRequest(TextDocumentTextPresentationName); + + /// + /// Strongly typed message object for 'textDocument/_vs_spellCheckableRanges'. + /// + public static readonly LspRequest TextDocumentSpellCheckableRanges = new LspRequest(TextDocumentSpellCheckableRangesName); + + /// + /// Strongly typed message object for 'workspace/_vs_spellCheckableRanges'. + /// + public static readonly LspRequest WorkspaceSpellCheckableRanges = new LspRequest(WorkspaceSpellCheckableRangesName); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMultipleContextFeatures.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMultipleContextFeatures.cs new file mode 100644 index 0000000000000..5d1a9a362d3eb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalMultipleContextFeatures.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Lists the features that support sending off feature requests for all available project contexts instead of the default active one. + /// + [DataContract] + public class VSInternalMultipleContextFeatures + { + /// + /// Gets or sets a value indicating whether the server provides support for sending diagnostics requests for all project contexts. + /// + [DataMember(Name = "_vs_SupportsMultipleContextDiagnostics")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsMultipleContextsDiagnostics + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalPriorityLevel.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalPriorityLevel.cs new file mode 100644 index 0000000000000..152598f915258 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalPriorityLevel.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum which represents the various reference kinds. + /// + public enum VSInternalPriorityLevel + { + /// + /// Lowest priority. + /// + Lowest = 0, + + /// + /// Low priority. + /// + Low = 1, + + /// + /// Medium priority. + /// + Normal = 2, + + /// + /// High priority. + /// + High = 3, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalProjectContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalProjectContext.cs new file mode 100644 index 0000000000000..6849b36182fa9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalProjectContext.cs @@ -0,0 +1,81 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class for a project context. + /// + [DataContract] + public class VSInternalProjectContext : VSProjectContext, IEquatable + { + /// + /// Gets or sets the string context kind of the project context. + /// + [DataMember(Name = "_vs_vsKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalKindAndModifier? VSKind + { + get; + set; + } + + public static bool operator ==(VSInternalProjectContext? value1, VSInternalProjectContext? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + if (value2 is null) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(VSInternalProjectContext? value1, VSInternalProjectContext? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(VSInternalProjectContext other) + { + return base.Equals(other) + && this.VSKind == other.VSKind; + } + + /// + public override bool Equals(VSProjectContext other) + { + return this.Equals((object)other); + } + + /// + public override bool Equals(object obj) + { + if (obj is VSInternalProjectContext other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return base.GetHashCode() + ^ (this.VSKind == null ? 13 : this.VSKind.GetHashCode() * 79); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceItem.cs new file mode 100644 index 0000000000000..39568f680043c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceItem.cs @@ -0,0 +1,195 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Roslyn.Text.Adornments; + using Newtonsoft.Json; + + /// + /// Class which represents references information. + /// + [DataContract] + public class VSInternalReferenceItem + { + private object? definitionTextValue = null; + private object? textValue = null; + + /// + /// Gets or sets the reference id. + /// + [DataMember(Name = "_vs_id", IsRequired = true)] + public int Id + { + get; + set; + } + + /// + /// Gets or sets the reference location. + /// + [DataMember(Name = "_vs_location")] + public Location Location + { + get; + set; + } + + /// + /// Gets or sets the definition Id. + /// + [DataMember(Name = "_vs_definitionId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? DefinitionId + { + get; + set; + } + + /// + /// Gets or sets the definition text displayed as a header when references are grouped by Definition. + /// Must be of type , , and . + /// + /// + /// This element should colorize syntax, but should not contain highlighting, e.g. + /// embedded within should not define . + /// + [DataMember(Name = "_vs_definitionText")] + [JsonConverter(typeof(ObjectContentConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? DefinitionText + { + get + { + return this.definitionTextValue; + } + + set + { + if (value == null || // Null is accepted since for non-definition references + (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string)) + { + this.definitionTextValue = value; + } + else + { + throw new InvalidOperationException($"{value.GetType()} is an invalid type."); + } + } + } + + /// + /// Gets or sets the resolution status. + /// + [DataMember(Name = "_vs_resolutionStatus")] + public VSInternalResolutionStatusKind ResolutionStatus + { + get; + set; + } + + /// + /// Gets or sets the reference kind. + /// + [DataMember(Name = "_vs_kind")] + public VSInternalReferenceKind[] Kind + { + get; + set; + } + + /// + /// Gets or sets the document name to be displayed to user when needed.This can be used in cases where URI doesn't have a user friendly file name or it is a remote URI. + /// + [DataMember(Name = "_vs_documentName")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? DocumentName { get; set; } + + /// + /// Gets or sets the project name. + /// + [DataMember(Name = "_vs_projectName")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ProjectName { get; set; } + + /// + /// Gets or sets the containing type. + /// + [DataMember(Name = "_vs_containingType")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ContainingType { get; set; } + + /// + /// Gets or sets the containing member. + /// + [DataMember(Name = "_vs_containingMember")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ContainingMember { get; set; } + + /// + /// Gets or sets the text value for a location reference. + /// Must be of type or or or . + /// + /// + /// + /// This element should colorize syntax and highlight the range containing the reference. + /// Highlighting can be achieved by setting + /// on embedded within . + /// + /// + /// Encouraged values for are: + /// "MarkerFormatDefinition/HighlightedReference" for read references, + /// "MarkerFormatDefinition/HighlightedWrittenReference" for write references, + /// "MarkerFormatDefinition/HighlightedDefinition" for definitions. + /// + /// + [DataMember(Name = "_vs_text")] + [JsonConverter(typeof(ObjectContentConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Text + { + get + { + return this.textValue; + } + + set + { + if (value is ImageElement || value is ContainerElement || value is ClassifiedTextElement || value is string) + { + this.textValue = value; + } + else + { + throw new InvalidOperationException($"{value?.GetType()} is an invalid type."); + } + } + } + + /// + /// Gets or sets the text value for display path.This would be a friendly display name for scenarios where the actual path on disk may be confusing for users. + /// This doesn't have to correspond to a real file path, but does need to be parsable by the various Path.GetFileName() methods. + /// + [DataMember(Name = "_vs_displayPath")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? DisplayPath { get; set; } + + /// + /// Gets or sets the origin of the item.The origin is used to filter remote results. + /// + [DataMember(Name = "_vs_origin")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalItemOrigin? Origin { get; set; } + + /// + /// Gets or sets the icon to show for the definition header. + /// + [DataMember(Name = "_vs_definitionIcon")] + [JsonConverter(typeof(ImageElementConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ImageElement? DefinitionIcon { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceKind.cs new file mode 100644 index 0000000000000..bf80c84901ed8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceKind.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Diagnostics.CodeAnalysis; + + /// + /// Enum which represents the various reference kinds. + /// + public enum VSInternalReferenceKind + { + /// + /// Reference in inactive code block. + /// + Inactive, + + /// + /// Reference in comment. + /// + Comment, + + /// + /// Reference in a string. + /// + String, + + /// + /// Read operation on the reference. + /// + Read, + + /// + /// Write operation on the reference. + /// + Write, + + /// + /// Reference. + /// + Reference, + + /// + /// Name. + /// + Name, + + /// + /// Qualified. + /// + Qualified, + + /// + /// Type Argument. + /// + TypeArgument, + + /// + /// Type Constraint. + /// + TypeConstraint, + + /// + /// Base Type. + /// + BaseType, + + /// + /// Construct. + /// + Constructor, + + /// + /// Destructor. + /// + Destructor, + + /// + /// Import. + /// + Import, + + /// + /// Declaration. + /// + Declaration, + + /// + /// Address of. + /// + AddressOf, + + /// + /// Not a reference. + /// + NotReference, + + /// + /// Unknown. + /// + Unknown, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceParams.cs new file mode 100644 index 0000000000000..0324d26992a13 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalReferenceParams.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents extensions of passed as parameter of find reference requests. + /// + public class VSInternalReferenceParams : ReferenceParams + { + /// + /// Gets or sets a value indicating the scope of returned items. + /// + [DataMember(Name = "_vs_scope")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalItemOrigin? Scope + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSelection.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSelection.cs new file mode 100644 index 0000000000000..76d21bdfa5941 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSelection.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the user configuration (as defined in ) for a rename request. + /// + [DataContract] + public class VSInternalRenameOptionSelection + { + /// + /// Gets or sets the name that identifies the option. + /// + [DataMember(Name = "_vs_name")] + [JsonProperty(Required = Required.Always)] + public string Name + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the user selected the option. + /// + [DataMember(Name = "_vs_value")] + [JsonProperty(Required = Required.Always)] + public bool Value + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSupport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSupport.cs new file mode 100644 index 0000000000000..54cd7ca5dabbb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameOptionSupport.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a renaming option for customizing the edit in the 'textDocument/rename' request. + /// + [DataContract] + public class VSInternalRenameOptionSupport + { + /// + /// Gets or sets the name that identifies the option. + /// + [DataMember(Name = "_vs_name")] + [JsonProperty(Required = Required.Always)] + public string Name + { + get; + set; + } + + /// + /// Gets or sets the user-facing option label. + /// + [DataMember(Name = "_vs_label")] + [JsonProperty(Required = Required.Always)] + public string Label + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the option has a default value of true. + /// + [DataMember(Name = "_vs_default")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Default + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameParams.cs new file mode 100644 index 0000000000000..55e31207eabb0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameParams.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters (together with extra VS-specific options) sent for the + /// 'textDocument/rename' request. + /// + [DataContract] + public class VSInternalRenameParams : RenameParams + { + /// + /// Gets or sets the rename option values as selected by the user. + /// + [DataMember(Name = "_vs_optionSelections")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalRenameOptionSelection[]? OptionSelections + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameRange.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameRange.cs new file mode 100644 index 0000000000000..d5e5e1908eb2f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalRenameRange.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a possible result value of the 'textDocument/prepareRename' request, + /// together with extra VS-specific options. + /// + [DataContract] + public class VSInternalRenameRange : RenameRange + { + /// + /// Gets or sets the supported options for the rename request. + /// + [DataMember(Name = "_vs_supportedOptions")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalRenameOptionSupport[]? SupportedOptions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalResolutionStatusKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalResolutionStatusKind.cs new file mode 100644 index 0000000000000..44949dd302ee8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalResolutionStatusKind.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum which represents the various resolutions for a reference entry. + /// + public enum VSInternalResolutionStatusKind + { + /// + /// Entry has been processed and confirmed as a reference. + /// + ConfirmedAsReference, + + /// + /// Entry has been processed and confimed as not a reference. + /// + ConfirmedAsNotReference, + + /// + /// Entry has been processed but could not be confirmed. + /// + NotConfirmed, + + /// + /// Entry has not been processed. + /// + NotProcessed, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSelectedCompletionInfo.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSelectedCompletionInfo.cs new file mode 100644 index 0000000000000..c41461635c88f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSelectedCompletionInfo.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Information about the selected completion item for . + /// + /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L48. + /// + public class VSInternalSelectedCompletionInfo + { + /// + /// Gets or sets the range of the selected completion item. + /// + [DataMember(Name = "_vs_range")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public Range Range { get; set; } + + /// + /// Gets or sets the text of the selected completion item. + /// + [DataMember(Name = "_vs_text")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public string Text { get; set; } + + /// + /// Gets or sets the completion item kind of the selected completion item. + /// + [DataMember(Name = "_vs_completionKind")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public CompletionItemKind CompletionKind { get; set; } + + /// + /// Gets or sets a value indicating whether the completion item is a snippet. + /// + [DataMember(Name = "_vs_isSnippetText")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool IsSnippetText { get; set; } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalServerCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalServerCapabilities.cs new file mode 100644 index 0000000000000..7c8f0a4c903fd --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalServerCapabilities.cs @@ -0,0 +1,168 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Extension class for ServerCapabilities with fields specific to Visual Studio. + /// + [DataContract] + public class VSInternalServerCapabilities : VSServerCapabilities + { + /// + /// Gets or sets a value indicating whether or not GoTo's integration with + /// 'workspace/symbol' and the deprecated 16.3 'workspace/beginSymbol' messages + /// should be disabled. + /// + /// + /// This is provided to facilitate transition from in-proc to OOP for teams that + /// currently own both a Language Server for Ctrl+Q and a GoTo provider. + /// + [DataMember(Name = "_vs_disableGoToWorkspaceSymbols")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DisableGoToWorkspaceSymbols + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether document/_ms_references is supported. + /// + [DataMember(Name = "_vs_ReferencesProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool MSReferencesProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports OnAutoInsert. + /// + [DataMember(Name = "_vs_onAutoInsertProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDocumentOnAutoInsertOptions? OnAutoInsertProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server requires document text to be included in textDocument/didOpen notifications. + /// + /// This capability is not intended to be included into the official LSP, hence _ms_ prefix. + [DataMember(Name = "_vs_doNotIncludeTextInTextDocumentDidOpen")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DoNotIncludeTextInTextDocumentDidOpen + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support to resolve string based response kinds. + /// + [DataMember(Name = "_vs_KindDescriptionResolveProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool KindDescriptionResolveProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support for diagnostic pull requests. + /// + [DataMember(Name = "_vs_supportsDiagnosticRequests")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SupportsDiagnosticRequests + { + get; + set; + } + + /// + /// Gets or sets server specified options for diagnostic pull requests. + /// + [DataMember(Name = "_vs_diagnosticProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalDiagnosticOptions? DiagnosticProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support for multiple context requests. + /// + [DataMember(Name = "_vs_MultipleContextSupportProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalMultipleContextFeatures? MultipleContextSupportProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support for inline completion requests. + /// + [DataMember(Name = "_vs_inlineCompletionOptions")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalInlineCompletionOptions? InlineCompletionOptions + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides support for spell checking. + /// + [DataMember(Name = "_vs_spellCheckingProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SpellCheckingProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports validating breakable ranges. + /// + [DataMember(Name = "_vs_breakableRangeProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool BreakableRangeProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports uri presentation. + /// + [DataMember(Name = "_vs_uriPresentationProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool UriPresentationProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports text presentation. + /// + [DataMember(Name = "_vs_textPresentationProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool TextPresentationProvider + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSignatureInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSignatureInformation.cs new file mode 100644 index 0000000000000..ad1434fc496dd --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSignatureInformation.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Roslyn.Text.Adornments; + using Newtonsoft.Json; + + /// + /// Extension class for signature help information which contains colorized label information. + /// + [DataContract] + public class VSInternalSignatureInformation : SignatureInformation + { + /// + /// Gets or sets the value representing the colorized label. + /// + [DataMember(Name = "_vs_colorizedLabel")] + [JsonConverter(typeof(ClassifiedTextElementConverter))] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ClassifiedTextElement? ColorizedLabel + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSnippetSupportLevel.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSnippetSupportLevel.cs new file mode 100644 index 0000000000000..3fdbe2aa57068 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSnippetSupportLevel.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// The version of support that is available from the client. + /// + public enum VSInternalSnippetSupportLevel + { + /// + /// Only default tab stops ($0) are supported. + /// + DefaultTabStop = 1, + + /// + /// Complete snippet support is available. + /// + Complete = 99, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs new file mode 100644 index 0000000000000..3b6cd9950c6e0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeKind.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Enum to represent the spell checkable region kinds. + /// + public enum VSInternalSpellCheckableRangeKind + { + /// + /// Represents a span of a string. + /// + String = 0, + + /// + /// Represents a span of a comment. + /// + Comment = 1, + + /// + /// Represents a span of an identifier declaration. + /// + Identifier = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs new file mode 100644 index 0000000000000..4ad51cf31ff96 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSpellCheckableRangeReport.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + using Newtonsoft.Json; + + /// + /// Report of spell checkable ranges. + /// + [DataContract] + public class VSInternalSpellCheckableRangeReport + { + /// + /// Gets or sets the server-generated version number for the spell checkable ranges. + /// This is treated as a black box by the client: it is stored on the client + /// for each textDocument and sent back to the server when requesting + /// spell checkable ranges. The server can use this result ID to avoid resending + /// spell checkable ranges that had previously been sent. + /// + [DataMember(Name = "_vs_resultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ResultId { get; set; } + + /// + /// Gets or sets an array containing encoded ranges to spell check. + /// + /// + /// The data structure is as the following: + /// 1. property can contain multiple spans to spell check. + /// 2. Each span is defined by a set of 3 ordered integers in the property. + /// 3. The span's ordered information are the following: + /// 1. A kind, corresponding to the numeric value of . + /// 2. A start position, which is the character index where the span starts in the document buffer. + /// The start position should be the relative offset from the end of the previous span, regardless of whether that span is the same range + /// or a prior range. + /// 3. The length of the span. + /// 4. Spans should be ordered by their absolute start position in the document buffer. + /// + /// + /// [ + /// /* ---- First span in the document, admitting this is the first report returned. ---- */ + /// 1, // The kind of the span. Equivalent to . + /// 123, // This is the very first span's start position. The position is relative to the beginning of the document buffer. + /// 5, // Span length + /// /* ---- Second span in the document ---- */ + /// 0, // Equivalent to . + /// 6, // Start position relative to the first span in the document. Absolute span position is therefore (123 + 5) + 6 = 134. + /// 4, // Span length + /// /* ---- Third span in the document ---- */ + /// 0, // Equivalent to . + /// 12, // Start position relative to the second span. Absolute span position is therefore (134 + 4) + 12 = 150 + /// 5 // Span length + /// ] + /// + [DataMember(Name = "_vs_ranges")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int[]? Ranges + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalStreamingParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalStreamingParams.cs new file mode 100644 index 0000000000000..0326d799f1082 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalStreamingParams.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a streaming pull request parameter used. + /// + /// TODO: Deprecate VSInternalDiagnosticParams.cs to use this merged param instead. + /// + [DataContract] + public class VSInternalStreamingParams : ITextDocumentParams + { + /// + /// Gets or sets the document for which the feature is being requested for. + /// + [DataMember(Name = "_vs_textDocument", IsRequired = true)] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets the server-generated version number for the feature request. + /// + /// + /// + /// This is treated as a black box by the client: it is stored on the client + /// for each textDocument and sent back to the server when requesting + /// the feature. The server can use this result ID to avoid resending + /// feature results that had previously been sent. + /// + /// Note that if a client does request results that haven’t changed, the + /// language server should not reply with any results for that document. + /// If the client requests results for a file that has been renamed or + /// deleted, then the language service should respond with null for the + /// results. + /// Also, if a service is reporting multiple reports for the same + /// document, then all reports are expected to have the same + /// previousResultId. + /// + [DataMember(Name = "_vs_previousResultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? PreviousResultId { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSymbolInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSymbolInformation.cs new file mode 100644 index 0000000000000..bcce8eea9b8e1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalSymbolInformation.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Extension class for SymbolInformation with fields specific to Visual Studio functionalities. + /// + /// + /// This is a temporary protocol and should not be used. + /// + [DataContract] + public class VSInternalSymbolInformation : VSSymbolInformation + { + /// + /// Gets or sets the string kind used for icons. + /// + [DataMember(Name = "_vs_vsKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalKindAndModifier? VSKind { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs new file mode 100644 index 0000000000000..f41a8aac9181e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Text document capabilities specific to Visual Studio. + /// + public class VSInternalTextDocumentClientCapabilities : TextDocumentClientCapabilities + { + /// + /// Gets or sets the setting which determines if on auto insert can be dynamically registered. + /// + [DataMember(Name = "_vs_onAutoInsert")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? OnAutoInsert + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs new file mode 100644 index 0000000000000..a5483ffd22395 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextDocumentRegistrationOptions.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// / Class representing the options for registering textDocument/_vs_OnAutoInsert support. + /// + [DataContract] + public class VSInternalTextDocumentRegistrationOptions : TextDocumentRegistrationOptions + { + /// + /// Gets or sets trigger characters for on auto insert. + /// + [DataMember(Name = "_vs_triggerCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? TriggerCharacters + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextPresentationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextPresentationParams.cs new file mode 100644 index 0000000000000..b1ed465f26f51 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalTextPresentationParams.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent for a textDocument/_vs_textPresentation request. + /// + [DataContract] + public class VSInternalTextPresentationParams : ITextDocumentParams + { + /// + /// Gets or sets the identifier for the text document to be operate on. + /// + [DataMember(Name = "_vs_textDocument")] + [JsonProperty(Required = Required.Always)] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the range. + /// + [DataMember(Name = "_vs_range")] + [JsonProperty(Required = Required.Always)] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the text. + /// + [DataMember(Name = "_vs_text")] + public string? Text + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalUriPresentationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalUriPresentationParams.cs new file mode 100644 index 0000000000000..2b7684ba84218 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalUriPresentationParams.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters sent for a textDocument/_vs_uriPresentation request. + /// + [DataContract] + public class VSInternalUriPresentationParams : ITextDocumentParams + { + /// + /// Gets or sets the identifier for the text document to be operate on. + /// + [DataMember(Name = "_vs_textDocument")] + [JsonProperty(Required = Required.Always)] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the range. + /// + [DataMember(Name = "_vs_range")] + [JsonProperty(Required = Required.Always)] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the URI values. Valid for DropKind.Uris. + /// + [DataMember(Name = "_vs_uris")] + [JsonProperty(ItemConverterType = typeof(DocumentUriConverter))] + public Uri[]? Uris + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs new file mode 100644 index 0000000000000..3463f20c54b90 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalValidateBreakableRangeParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for the textDocument/validateBreakableRange request. + /// + [DataContract] + public class VSInternalValidateBreakableRangeParams : ITextDocumentParams + { + /// + /// Gets or sets the for the request. + /// + [DataMember(Name = "_vs_textDocument")] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets the at which the request was sent. + /// + [DataMember(Name = "_vs_range")] + public Range Range { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs new file mode 100644 index 0000000000000..210e6cca52b5c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWellKnownCodeActionCommands.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class which contains the string values for all well-known Visual Studion LSP code action commands. + /// + public static class VSInternalWellKnownCodeActionCommands + { + /// + /// Command name for '_ms_setClipboard'. + /// + public const string SetClipboard = "_ms_setClipboard"; + + /// + /// Command name for '_ms_openUrl'. + /// + public const string OpenUrl = "_ms_openUrl"; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs new file mode 100644 index 0000000000000..4eac2e803cbb8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using System.Text; + using Newtonsoft.Json; + + /// + /// Parameter for workspace/_vs_spellCheckableRanges. + /// + [DataContract] + public class VSInternalWorkspaceSpellCheckableParams : IPartialResultParams + { + /// + /// Gets or sets the current state of the documents the client already has received. + /// + [DataMember(Name = "_vs_previousResults")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public VSInternalStreamingParams[]? PreviousResults { get; set; } + + /// + /// Gets or sets an optional token that a server can use to report partial results (e.g. streaming) to the client. + /// + [DataMember(Name = "_vs_partialResultToken")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs new file mode 100644 index 0000000000000..b9de110b93be7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Internal/VSInternalWorkspaceSpellCheckableReport.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using System.Text; + + /// + /// Report for workspace spell checkable range request. + /// + [DataContract] + public class VSInternalWorkspaceSpellCheckableReport : VSInternalSpellCheckableRangeReport, ITextDocumentParams + { + /// + /// Gets or sets the document for which the spell checkable ranges are returned. + /// + [DataMember(Name = "_vs_textDocument", IsRequired = true)] + public TextDocumentIdentifier TextDocument { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.csproj b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.csproj new file mode 100644 index 0000000000000..bba922bb53a16 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.csproj @@ -0,0 +1,59 @@ + + + Microsoft.VisualStudio.LanguageServer.Protocol + + + + + + + Microsoft.VisualStudio.LanguageServer.Protocol + netstandard2.0 + true + LanguageServer.Protocol.ruleset + false + true + true + + + true + A .NET implementation of the Language Server Protocol + $(Summary) + false + true + true + Microsoft VisualStudio LanguageServer Language Server Protocol VSSDK + $(PackageOutputPath)\nuget-public + true + RS0037,SA1011,1591,8618,CA1704 + en-US + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + True + True + Resources.resx + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.ruleset b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.ruleset new file mode 100644 index 0000000000000..05183f019ae27 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LanguageServer.Protocol.ruleset @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeOptions.cs new file mode 100644 index 0000000000000..4614624db1811 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents linked editing range capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class LinkedEditingRangeOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeParams.cs new file mode 100644 index 0000000000000..6c1d28bae21fd --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRangeParams.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for a textDocument/linkedEditingRange request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class LinkedEditingRangeParams : TextDocumentPositionParams + { + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRanges.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRanges.cs new file mode 100644 index 0000000000000..0333feaf1decf --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LinkedEditingRanges.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the response of an LinkedEditingRanges response. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class LinkedEditingRanges + { + /// + /// Gets or sets the ranges for the type rename. + /// + [DataMember(Name = "ranges")] + public Range[] Ranges + { + get; + set; + } + + /// + /// Gets or sets the word pattern for the type rename. + /// + [DataMember(Name = "wordPattern")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? WordPattern + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Location.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Location.cs new file mode 100644 index 0000000000000..14888f4a702c5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Location.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a location in a document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Location : IEquatable + { + /// + /// Gets or sets the URI for the document the location belongs to. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the range of the location in the document. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + public override bool Equals(object obj) + { + return this.Equals(obj as Location); + } + + /// + public bool Equals(Location? other) + { + return other != null && this.Uri != null && other.Uri != null && + this.Uri.Equals(other.Uri) && + EqualityComparer.Default.Equals(this.Range, other.Range); + } + + /// + public override int GetHashCode() + { + var hashCode = 1486144663; + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Uri); + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Range); + return hashCode; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LogMessageParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LogMessageParams.cs new file mode 100644 index 0000000000000..1d68f2800f109 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LogMessageParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents parameter sent with window/logMessage requests. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class LogMessageParams + { + /// + /// Gets or sets the type of message. + /// + [DataMember(Name = "type")] + public MessageType MessageType + { + get; + set; + } + + /// + /// Gets or sets the message. + /// + [DataMember(Name = "message")] + public string Message + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspNotification.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspNotification.cs new file mode 100644 index 0000000000000..85b0bb5accff1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspNotification.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Strongly typed object used to specify a LSP notification's parameter type. + /// + /// The parameter type. + public class LspNotification + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the JSON-RPC notification. + public LspNotification(string name) + { + this.Name = name; + } + + /// + /// Gets the name of the JSON-RPC notification. + /// + public string Name { get; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspRequest.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspRequest.cs new file mode 100644 index 0000000000000..2e3a75f5a66ed --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/LspRequest.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Strongly typed object used to specify a LSP requests's parameter and return types. + /// + /// The parameter type. + /// The return type. + public class LspRequest + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the JSON-RPC request. + public LspRequest(string name) + { + this.Name = name; + } + + /// + /// Gets the name of the JSON-RPC request. + /// + public string Name { get; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkedString.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkedString.cs new file mode 100644 index 0000000000000..3ba17a0ad8d74 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkedString.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing human readable text that should be rendered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class MarkedString + { + /// + /// Gets or sets the language of the code stored in . + /// + [DataMember(Name = "language")] + [JsonProperty(Required = Required.Always)] + public string Language + { + get; + set; + } + + /// + /// Gets or sets the code. + /// + [DataMember(Name = "value")] + [JsonProperty(Required = Required.Always)] + public string Value + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupContent.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupContent.cs new file mode 100644 index 0000000000000..5ec68c694b4c8 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupContent.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing text and an associated format that should be rendered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class MarkupContent + { + /// + /// Gets or sets the representing the text's format. + /// + [DataMember(Name = "kind")] + public MarkupKind Kind + { + get; + set; + } + + /// + /// Gets or sets the text that should be rendered. + /// + [DataMember(Name = "value")] + public string Value + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupKind.cs new file mode 100644 index 0000000000000..d517cde96ed4d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MarkupKind.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Value representing the various formats of markup text. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct MarkupKind(string Value) : IStringEnum + { + /// + /// Markup type is plain text. + /// + public static readonly MarkupKind PlainText = new("plaintext"); + + /// + /// Markup type is Markdown. + /// + public static readonly MarkupKind Markdown = new("markdown"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MaybeNullWhenAttribute.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MaybeNullWhenAttribute.cs new file mode 100644 index 0000000000000..2e0d94ec9ba30 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MaybeNullWhenAttribute.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics.CodeAnalysis +{ + /// Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. + [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] + internal sealed class MaybeNullWhenAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// Initializes the attribute with the specified return value condition. + /// + /// + /// The return value condition. If the method returns this value, the associated parameter may be null. + /// + public MaybeNullWhenAttribute(bool returnValue) => this.ReturnValue = returnValue; + + /// Gets the return value condition. + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1623:Property summary documentation should match accessors", Justification = "Used alternate wording")] + public bool ReturnValue { get; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageActionItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageActionItem.cs new file mode 100644 index 0000000000000..105d27cc3d9af --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageActionItem.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represent an action the user performs after a window/showMessageRequest request is sent. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class MessageActionItem + { + /// + /// Gets or sets the title. + /// + [DataMember(Name = "title")] + public string Title + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageType.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageType.cs new file mode 100644 index 0000000000000..1b0ba88e93aa5 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/MessageType.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Message type enum. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum MessageType + { + /// + /// Error message. + /// + Error = 1, + + /// + /// Warning message. + /// + Warning = 2, + + /// + /// Info message. + /// + Info = 3, + + /// + /// Log message. + /// + Log = 4, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Methods.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Methods.cs new file mode 100644 index 0000000000000..39706da80ed1c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Methods.cs @@ -0,0 +1,603 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + /// + /// Class which contains the string values for all common language protocol methods. + /// + public static class Methods + { + /// + /// Method name for 'initialize'. + /// + public const string InitializeName = "initialize"; + + /// + /// Method name for 'initialized'. + /// + public const string InitializedName = "initialized"; + + /// + /// Method name for '$/progress' notifications. + /// + public const string ProgressNotificationName = "$/progress"; + + /// + /// Name of the progress token in the request. + /// + public const string PartialResultTokenName = "partialResultToken"; + + /// + /// Name of the progress token in the request. + /// + public const string PartialResultTokenPropertyName = "PartialResultToken"; + + /// + /// Name of the work done token in the request. + /// + public const string WorkDoneTokenName = "workDoneToken"; + + /// + /// Name of the progress token in the $/progress notification. + /// + public const string ProgressNotificationTokenName = "token"; + + /// + /// Method name for 'textDocument/codeAction'. + /// + public const string TextDocumentCodeActionName = "textDocument/codeAction"; + + /// + /// Method name for 'textDocument/codeLens'. + /// + public const string TextDocumentCodeLensName = "textDocument/codeLens"; + + /// + /// Method name for 'codeAction/resolve'. + /// + public const string CodeActionResolveName = "codeAction/resolve"; + + /// + /// Method name for 'codeLens/resolve'. + /// + public const string CodeLensResolveName = "codeLens/resolve"; + + /// + /// Method name for 'textDocument/completion'. + /// + public const string TextDocumentCompletionName = "textDocument/completion"; + + /// + /// Method name for 'completionItem/resolve'. + /// + public const string TextDocumentCompletionResolveName = "completionItem/resolve"; + + /// + /// Method name for 'textDocument/definition'. + /// + public const string TextDocumentDefinitionName = "textDocument/definition"; + + /// + /// Method name for 'textDocument/diagnostic'. + /// + public const string TextDocumentDiagnosticName = "textDocument/diagnostic"; + + /// + /// Method name for 'textDocument/didOpen'. + /// + public const string TextDocumentDidOpenName = "textDocument/didOpen"; + + /// + /// Method name for 'textDocument/didClose'. + /// + public const string TextDocumentDidCloseName = "textDocument/didClose"; + + /// + /// Method name for 'textDocument/didChange'. + /// + public const string TextDocumentDidChangeName = "textDocument/didChange"; + + /// + /// Method name for 'textDocument/didSave'. + /// + public const string TextDocumentDidSaveName = "textDocument/didSave"; + + /// + /// Method name for 'textDocument/documentHighlight'. + /// + public const string TextDocumentDocumentHighlightName = "textDocument/documentHighlight"; + + /// + /// Method name for 'textDocument/documentLink'. + /// + public const string TextDocumentDocumentLinkName = "textDocument/documentLink"; + + /// + /// Method name for 'documentLink/resolve'. + /// + public const string DocumentLinkResolveName = "documentLink/resolve"; + + /// + /// Method name for 'textDocument/documentColor'. + /// + public const string TextDocumentDocumentColorName = "textDocument/documentColor"; + + /// + /// Method name for 'textDocument/documentSymbol'. + /// + public const string TextDocumentDocumentSymbolName = "textDocument/documentSymbol"; + + /// + /// Method name for 'textDocument/foldingRange'. + /// + public const string TextDocumentFoldingRangeName = "textDocument/foldingRange"; + + /// + /// Method name for 'textDocument/formatting'. + /// + public const string TextDocumentFormattingName = "textDocument/formatting"; + + /// + /// Method name for 'textDocument/hover'. + /// + public const string TextDocumentHoverName = "textDocument/hover"; + + /// + /// Method name for 'textDocument/onTypeFormatting'. + /// + public const string TextDocumentOnTypeFormattingName = "textDocument/onTypeFormatting"; + + /// + /// Method name for 'textDocument/rangeFormatting'. + /// + public const string TextDocumentRangeFormattingName = "textDocument/rangeFormatting"; + + /// + /// Method name for 'textDocument/publishDiagnostics'. + /// + public const string TextDocumentPublishDiagnosticsName = "textDocument/publishDiagnostics"; + + /// + /// Method name for 'textDocument/implementation'. + /// + public const string TextDocumentImplementationName = "textDocument/implementation"; + + /// + /// Method name for 'textDocument/inlayHint'. + /// + public const string TextDocumentInlayHintName = "textDocument/inlayHint"; + + /// + /// Method name for 'inlayHint/resolve'. + /// + public const string InlayHintResolveName = "inlayHint/resolve"; + + /// + /// Method name for 'textDocument/typeDefinition'. + /// + public const string TextDocumentTypeDefinitionName = "textDocument/typeDefinition"; + + /// + /// Method name for 'textDocument/references'. + /// + public const string TextDocumentReferencesName = "textDocument/references"; + + /// + /// Method name for 'textDocument/rename'. + /// + public const string TextDocumentRenameName = "textDocument/rename"; + + /// + /// Method name for 'textDocument/prepareRename'. + /// + public const string TextDocumentPrepareRenameName = "textDocument/prepareRename"; + + /// + /// Method name for 'textDocument/semanticTokens/full'. + /// + public const string TextDocumentSemanticTokensFullName = "textDocument/semanticTokens/full"; + + /// + /// Method name for 'textDocument/semanticTokens/range'. + /// + public const string TextDocumentSemanticTokensRangeName = "textDocument/semanticTokens/range"; + + /// + /// Method name for 'textDocument/semanticTokens/full/delta'. + /// + public const string TextDocumentSemanticTokensFullDeltaName = "textDocument/semanticTokens/full/delta"; + + /// + /// Method name for 'textDocument/signatureHelp'. + /// + public const string TextDocumentSignatureHelpName = "textDocument/signatureHelp"; + + /// + /// Method name for 'textDocument/willSave'. + /// + public const string TextDocumentWillSaveName = "textDocument/willSave"; + + /// + /// Method name for 'textDocument/willSaveWaitUntil'. + /// + public const string TextDocumentWillSaveWaitUntilName = "textDocument/willSaveWaitUntil"; + + /// + /// Method name for 'textDocument/linkedEditingRange'. + /// + public const string TextDocumentLinkedEditingRangeName = "textDocument/linkedEditingRange"; + + /// + /// Method name for 'window/logMessage'. + /// + public const string WindowLogMessageName = "window/logMessage"; + + /// + /// Method name for 'window/showMessage'. + /// + public const string WindowShowMessageName = "window/showMessage"; + + /// + /// Method name for 'window/showMessageRequest'. + /// + public const string WindowShowMessageRequestName = "window/showMessageRequest"; + + /// + /// Method name for 'workspace/applyEdit'. + /// + public const string WorkspaceApplyEditName = "workspace/applyEdit"; + + /// + /// Method name for 'workspace/semanticTokens/refresh'. + /// + public const string WorkspaceSemanticTokensRefreshName = "workspace/semanticTokens/refresh"; + + /// + /// Method name for 'workspace/configuration'. + /// + public const string WorkspaceConfigurationName = "workspace/configuration"; + + /// + /// Method name for 'workspace/diagnostic'. + /// + public const string WorkspaceDiagnosticName = "workspace/diagnostic"; + + /// + /// Method name for 'workspace/diagnostic/refresh'. + /// + public const string WorkspaceDiagnosticRefreshName = "workspace/diagnostic/refresh"; + + /// + /// Method name for 'workspace/didChangeConfiguration'. + /// + public const string WorkspaceDidChangeConfigurationName = "workspace/didChangeConfiguration"; + + /// + /// Method name for 'workspace/executeCommand'. + /// + public const string WorkspaceExecuteCommandName = "workspace/executeCommand"; + + /// + /// Method name for 'workspace/symbol'. + /// + public const string WorkspaceSymbolName = "workspace/symbol"; + + /// + /// Method name for 'workspace/didChangeWatchedFiles'. + /// + public const string WorkspaceDidChangeWatchedFilesName = "workspace/didChangeWatchedFiles"; + + /// + /// Method name for 'workspace/codeLens/refresh'. + /// + public const string WorkspaceCodeLensRefreshName = "workspace/codeLens/refresh"; + + /// + /// Method name for 'workspace/inlayHint/refresh'. + /// + public const string WorkspaceInlayHintRefreshName = "workspace/inlayHint/refresh"; + + /// + /// Method name for 'shutdown'. + /// + public const string ShutdownName = "shutdown"; + + /// + /// Method name for 'exit'. + /// + public const string ExitName = "exit"; + + /// + /// Method name for 'telemetry/event'. + /// + public const string TelemetryEventName = "telemetry/event"; + + /// + /// Method name for 'client/registerCapability'. + /// + public const string ClientRegisterCapabilityName = "client/registerCapability"; + + /// + /// Method name for 'client/unregisterCapability'. + /// + public const string ClientUnregisterCapabilityName = "client/unregisterCapability"; + + /// + /// Strongly typed message object for 'initialize'. + /// + public static readonly LspRequest Initialize = new LspRequest(InitializeName); + + /// + /// Strongly typed message object for 'initialized'. + /// + public static readonly LspNotification Initialized = new LspNotification(InitializedName); + + /// + /// Strongly typed message object for 'textDocument/codeAction'. + /// + public static readonly LspRequest[]?> TextDocumentCodeAction = new LspRequest[]?>(TextDocumentCodeActionName); + + /// + /// Strongly typed message object for 'textDocument/codeLens'. + /// + public static readonly LspRequest TextDocumentCodeLens = new LspRequest(TextDocumentCodeLensName); + + /// + /// Strongly typed message object for 'codeAction/resolve'. + /// + public static readonly LspRequest CodeActionResolve = new LspRequest(CodeActionResolveName); + + /// + /// Strongly typed message object for 'codeLens/resolve'. + /// + public static readonly LspRequest CodeLensResolve = new LspRequest(CodeLensResolveName); + + /// + /// Strongly typed message object for 'textDocument/completion'. + /// + public static readonly LspRequest?> TextDocumentCompletion = new LspRequest?>(TextDocumentCompletionName); + + /// + /// Strongly typed message object for 'completionItem/resolve'. + /// + public static readonly LspRequest TextDocumentCompletionResolve = new LspRequest(TextDocumentCompletionResolveName); + + /// + /// Strongly typed message object for 'textDocument/definition'. + /// + public static readonly LspRequest?> TextDocumentDefinition = new LspRequest?>(TextDocumentDefinitionName); + + /// + /// Strongly typed message object for 'textDocument/didOpen'. + /// + public static readonly LspNotification TextDocumentDidOpen = new LspNotification(TextDocumentDidOpenName); + + /// + /// Strongly typed message object for 'textDocument/didClose'. + /// + public static readonly LspNotification TextDocumentDidClose = new LspNotification(TextDocumentDidCloseName); + + /// + /// Strongly typed message object for 'textDocument/didChange'. + /// + public static readonly LspNotification TextDocumentDidChange = new LspNotification(TextDocumentDidChangeName); + + /// + /// Strongly typed message object for 'textDocument/didSave'. + /// + public static readonly LspNotification TextDocumentDidSave = new LspNotification(TextDocumentDidSaveName); + + /// + /// Strongly typed message object for 'textDocument/documentHighlight'. + /// + public static readonly LspRequest TextDocumentDocumentHighlight = new LspRequest(TextDocumentDocumentHighlightName); + + /// + /// Strongly typed message object for 'textDocument/documentLink'. + /// + public static readonly LspRequest TextDocumentDocumentLink = new LspRequest(TextDocumentDocumentLinkName); + + /// + /// Strongly typed message object for 'documentLink/resolve'. + /// + public static readonly LspRequest DocumentLinkResolve = new LspRequest(DocumentLinkResolveName); + + /// + /// Strongly typed message object for 'textDocument/documentColor'. + /// + public static readonly LspRequest DocumentColorRequest = new LspRequest(TextDocumentDocumentColorName); + + /// + /// Strongly typed message object for 'textDocument/documentSymbol'. + /// + public static readonly LspRequest TextDocumentDocumentSymbol = new LspRequest(TextDocumentDocumentSymbolName); + + /// + /// Stronly typed message object for 'textDocument/foldingRange'. + /// + public static readonly LspRequest TextDocumentFoldingRange = new LspRequest(TextDocumentFoldingRangeName); + + /// + /// Strongly typed message object for 'textDocument/formatting'. + /// + public static readonly LspRequest TextDocumentFormatting = new LspRequest(TextDocumentFormattingName); + + /// + /// Strongly typed message object for 'textDocument/hover'. + /// + public static readonly LspRequest TextDocumentHover = new LspRequest(TextDocumentHoverName); + + /// + /// Strongly typed message object for 'textDocument/onTypeFormatting'. + /// + public static readonly LspRequest TextDocumentOnTypeFormatting = new LspRequest(TextDocumentOnTypeFormattingName); + + /// + /// Strongly typed message object for 'textDocument/rangeFormatting'. + /// + public static readonly LspRequest TextDocumentRangeFormatting = new LspRequest(TextDocumentRangeFormattingName); + + /// + /// Strongly typed message object for 'textDocument/publishDiagnostics'. + /// + public static readonly LspNotification TextDocumentPublishDiagnostics = new LspNotification(TextDocumentPublishDiagnosticsName); + + /// + /// Strongly typed message object for 'textDocument/implementation'. + /// + public static readonly LspRequest?> TextDocumentImplementation = new LspRequest?>(TextDocumentImplementationName); + + /// + /// Strongly typed message object for 'textDocument/inlayHint'. + /// + public static readonly LspRequest TextDocumentInlayHint = new LspRequest(TextDocumentInlayHintName); + + /// + /// Strongly typed message object for 'inlayHint/resolve'. + /// + public static readonly LspRequest InlayHintResolve = new LspRequest(InlayHintResolveName); + + /// + /// Strongly typed message object for 'textDocument/typeDefinition'. + /// + public static readonly LspRequest?> TextDocumentTypeDefinition = new LspRequest?>(TextDocumentTypeDefinitionName); + + /// + /// Strongly typed message object for 'textDocument/references'. + /// + public static readonly LspRequest TextDocumentReferences = new LspRequest(TextDocumentReferencesName); + + /// + /// Strongly typed message object for 'textDocument/rename'. + /// + public static readonly LspRequest TextDocumentRename = new LspRequest(TextDocumentRenameName); + + /// + /// Strongly typed message object for 'textDocument/prepareRename'. + /// + public static readonly LspRequest?> TextDocumentPrepareRename = new LspRequest?>(TextDocumentPrepareRenameName); + + /// + /// Strongly typed message object for 'textDocument/signatureHelp'. + /// + public static readonly LspRequest TextDocumentSignatureHelp = new LspRequest(TextDocumentSignatureHelpName); + + /// + /// Strongly typed message object for 'textDocument/willSave'. + /// + public static readonly LspNotification TextDocumentWillSave = new LspNotification(TextDocumentWillSaveName); + + /// + /// Strongly typed message object for 'textDocument/willSaveWaitUntil'. + /// + public static readonly LspRequest TextDocumentWillSaveWaitUntil = new LspRequest(TextDocumentWillSaveWaitUntilName); + + /// + /// Strongly typed message object for 'textDocument/linkedEditingRange'. + /// + public static readonly LspRequest TextDocumentLinkedEditingRange = new LspRequest(TextDocumentLinkedEditingRangeName); + + /// + /// Strongly typed message object for 'window/logMessage'. + /// + public static readonly LspNotification WindowLogMessage = new LspNotification(WindowLogMessageName); + + /// + /// Strongly typed message object for 'window/showMessage'. + /// + public static readonly LspNotification WindowShowMessage = new LspNotification(WindowShowMessageName); + + /// + /// Strongly typed message object for 'window/showMessageRequest'. + /// + public static readonly LspRequest WindowShowMessageRequest = new LspRequest(WindowShowMessageRequestName); + + /// + /// Strongly typed message object for 'workspace/applyEdit'. + /// + public static readonly LspRequest WorkspaceApplyEdit = new LspRequest(WorkspaceApplyEditName); + + /// + /// Strongly typed message object for 'workspace/semanticTokens/refresh'. + /// + public static readonly LspRequest WorkspaceSemanticTokensRefresh = new LspRequest(WorkspaceSemanticTokensRefreshName); + + /// + /// Strongly typed message object for 'workspace/configuration'. + /// + public static readonly LspRequest WorkspaceConfiguration = new LspRequest(WorkspaceConfigurationName); + + /// + /// Strongly typed message object for 'workspace/didChangeConfiguration'. + /// + public static readonly LspNotification WorkspaceDidChangeConfiguration = new LspNotification(WorkspaceDidChangeConfigurationName); + + /// + /// Strongly typed message object for 'workspace/executeCommand'. + /// + public static readonly LspRequest WorkspaceExecuteCommand = new LspRequest(WorkspaceExecuteCommandName); + + /// + /// Strongly typed message object for 'workspace/symbol'. + /// + public static readonly LspRequest WorkspaceSymbol = new LspRequest(WorkspaceSymbolName); + + /// + /// Strongly typed message object for 'workspace/didChangeWatchedFiles'. + /// + public static readonly LspNotification WorkspaceDidChangeWatchedFiles = new LspNotification(WorkspaceDidChangeWatchedFilesName); + + /// + /// Strongly typed message object for 'workspace/codeLens/refresh'. + /// + public static readonly LspRequest WorkspaceCodeLensRefresh = new LspRequest(WorkspaceCodeLensRefreshName); + + /// + /// Strongly typed message object for 'workspace/inlayHint/refresh'. + /// + public static readonly LspRequest WorkspaceInlayHintRefresh = new LspRequest(WorkspaceInlayHintRefreshName); + + /// + /// Strongly typed message object for 'shutdown'. + /// + public static readonly LspRequest Shutdown = new LspRequest(ShutdownName); + + /// + /// Strongly typed message object for 'exit'. + /// + public static readonly LspNotification Exit = new LspNotification(ExitName); + + /// + /// Strongly typed message object for 'telemetry/event'. + /// + public static readonly LspNotification TelemetryEvent = new LspNotification(TelemetryEventName); + + /// + /// Strongly typed message object for 'client/registerCapability'. + /// + public static readonly LspRequest ClientRegisterCapability = new LspRequest(ClientRegisterCapabilityName); + + /// + /// Strongly typed message object for 'client/unregisterCapability'. + /// + public static readonly LspRequest ClientUnregisterCapability = new LspRequest(ClientUnregisterCapabilityName); + + /// + /// Strongly typed message object for 'textDocument/semanticTokens/full'. + /// + public static readonly LspRequest TextDocumentSemanticTokensFull = new LspRequest(TextDocumentSemanticTokensFullName); + + /// + /// Strongly typed message object for 'textDocument/semanticTokens/range'. + /// + public static readonly LspRequest TextDocumentSemanticTokensRange = new LspRequest(TextDocumentSemanticTokensRangeName); + + /// + /// Strongly typed message object for 'textDocument/semanticTokens/full/delta'. + /// + public static readonly LspRequest?> TextDocumentSemanticTokensFullDelta + = new LspRequest?>(TextDocumentSemanticTokensFullDeltaName); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/OptionalVersionedTextDocumentIdentifier.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/OptionalVersionedTextDocumentIdentifier.cs new file mode 100644 index 0000000000000..e62ebfffd7546 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/OptionalVersionedTextDocumentIdentifier.cs @@ -0,0 +1,87 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Globalization; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a text document, but optionally has a version identifier. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class OptionalVersionedTextDocumentIdentifier : TextDocumentIdentifier, IEquatable + { + /// + /// Gets or sets the version of the document. + /// + [DataMember(Name = "version")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public int? Version + { + get; + set; + } + + public static bool operator ==(OptionalVersionedTextDocumentIdentifier? value1, OptionalVersionedTextDocumentIdentifier? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(OptionalVersionedTextDocumentIdentifier? value1, OptionalVersionedTextDocumentIdentifier? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(OptionalVersionedTextDocumentIdentifier other) + { + return other is not null + && this.Version == other.Version + && base.Equals(other); + } + + /// + public override bool Equals(object obj) + { + if (obj is OptionalVersionedTextDocumentIdentifier other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return this.Version == null ? 89 : this.Version.GetHashCode() + ^ (base.GetHashCode() * 79); + } + + /// + public override string ToString() + { + // Invariant culture because the culture on the server vs client may vary. + return base.ToString() + "|" + this.Version?.ToString(CultureInfo.InvariantCulture); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformation.cs new file mode 100644 index 0000000000000..feddcd7f83bf2 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformation.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a parameter of a callable signature. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(ParameterInformationConverter))] + public class ParameterInformation + { + /// + /// Gets or sets the label of the parameter. + /// + [DataMember(Name = "label")] + public SumType> Label + { + get; + set; + } + + /// + /// Gets or sets the human-readable documentation of the parameter. + /// + [DataMember(Name = "documentation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Documentation + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformationSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformationSetting.cs new file mode 100644 index 0000000000000..fc108ff0632b9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ParameterInformationSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameter information initialization setting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ParameterInformationSetting + { + /// + /// Gets or sets a value indicating whether the client supports label offset. + /// + [DataMember(Name = "labelOffsetSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool LabelOffsetSupport + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Position.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Position.cs new file mode 100644 index 0000000000000..d9cf43e5a08aa --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Position.cs @@ -0,0 +1,121 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + + /// + /// Class which represents a position on a text document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Position : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + public Position() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Line number. + /// Character number. + public Position(int line, int character) + { + this.Line = line; + this.Character = character; + } + + /// + /// Gets or sets the line number. + /// + [DataMember(Name = "line")] + public int Line + { + get; + set; + } + + /// + /// Gets or sets the character number. + /// + [DataMember(Name = "character")] + public int Character + { + get; + set; + } + + /// + /// Overrides default equals operator. Two positions are equal if they are both null or one of them is the object equivalent of the other. + /// + /// The first position to compare. + /// The second position to compare. + /// True if both positions are null or one of them is the object equivalent of the other, false otherwise. + public static bool operator ==(Position? firstPosition, Position? secondPosition) + { + if (firstPosition is null && secondPosition is null) + { + return true; + } + + if (firstPosition is null && secondPosition is not null) + { + return false; + } + + if (firstPosition is not null && secondPosition is null) + { + return false; + } + + return firstPosition!.Equals(secondPosition!); + } + + /// + /// Overrides the default not equals operator. + /// + /// The first position to compare. + /// The second position to compare. + /// True if first and second positions are not equivalent. + public static bool operator !=(Position? firstPosition, Position? secondPosition) + { + return !(firstPosition == secondPosition); + } + + /// + /// Overrides base class method . Two positions are equal if their line and character are the same. + /// + /// Object to compare to. + /// True if the given position has the same line and character; false otherwise. + public override bool Equals(object obj) + { + return this.Equals(obj as Position); + } + + /// + public bool Equals(Position? other) + { + return other != null && + this.Line == other.Line && + this.Character == other.Character; + } + + /// + /// Overrides base class method . + /// + /// Hashcode for this object. + public override int GetHashCode() + { + return this.Line ^ this.Character; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareRenameParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareRenameParams.cs new file mode 100644 index 0000000000000..caf25663ffb43 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareRenameParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters for the 'textDocument/prepare' request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class PrepareRenameParams : ITextDocumentPositionParams + { + /// + /// Gets or sets the value which identifies the document. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the position in which the rename is requested. + /// + [DataMember(Name = "position")] + public Position Position + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareSupportDefaultBehavior.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareSupportDefaultBehavior.cs new file mode 100644 index 0000000000000..76394fdab9bdc --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PrepareSupportDefaultBehavior.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum representing the default behavior used by the client for computing a rename range. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum PrepareSupportDefaultBehavior + { + /// + /// The client's default behavior is to select the identifier according to the language's syntax rule. + /// + Identifier = 1, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PreviousResultId.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PreviousResultId.cs new file mode 100644 index 0000000000000..d5308786bf9d0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PreviousResultId.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a previous result id in a workspace pull request. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class PreviousResultId +{ + /// + /// Gets or sets the URI for which the client knows a result id. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the value of the previous result id. + /// + [DataMember(Name = "value")] + public string Value + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticParams.cs new file mode 100644 index 0000000000000..596108a0ddc2e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticParams.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the parameter that's sent with 'textDocument/publishDiagnostics' messages. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class PublishDiagnosticParams + { + /// + /// Gets or sets the URI of the text document. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the collection of diagnostics. + /// + [DataMember(Name = "diagnostics")] + public Diagnostic[] Diagnostics + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticsSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticsSetting.cs new file mode 100644 index 0000000000000..5a2d82f8f2dda --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/PublishDiagnosticsSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the initialization setting for publish diagnostics. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class PublishDiagnosticsSetting + { + /// + /// Gets or sets a value indicating whether gets or sets the capabilities. + /// + [DataMember(Name = "tagSupport")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public TagSupport? TagSupport + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Range.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Range.cs new file mode 100644 index 0000000000000..7a08a66f195cd --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Range.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a text document text range. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Range : IEquatable + { + /// + /// Gets or sets the text start position. + /// + [DataMember(Name = "start")] + [JsonProperty(Required = Required.Always)] + public Position Start + { + get; + set; + } + + /// + /// Gets or sets the text end position. + /// + [DataMember(Name = "end")] + [JsonProperty(Required = Required.Always)] + public Position End + { + get; + set; + } + + public static bool operator ==(Range? value1, Range? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(Range? value1, Range? value2) + { + return !(value1 == value2); + } + + /// + public override bool Equals(object obj) + { + return this.Equals(obj as Range); + } + + /// + public bool Equals(Range? other) + { + return other != null && + EqualityComparer.Default.Equals(this.Start, other.Start) && + EqualityComparer.Default.Equals(this.End, other.End); + } + + /// + public override int GetHashCode() + { + var hashCode = -1676728671; + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Start); + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.End); + return hashCode; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceContext.cs new file mode 100644 index 0000000000000..a479e836e4381 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceContext.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing reference context information for find reference request parameter. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ReferenceContext + { + /// + /// Gets or sets a value indicating whether declaration should be included. + /// + [DataMember(Name = "includeDeclaration")] + public bool IncludeDeclaration + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceOptions.cs new file mode 100644 index 0000000000000..e06a024091aa7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ReferenceOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceParams.cs new file mode 100644 index 0000000000000..fad8eab1c40c0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ReferenceParams.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing find reference parameter for find reference request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ReferenceParams : TextDocumentPositionParams, IPartialResultParams + { + // Using IPartialResultParams instead of IPartialResultParams to + // allow the VS protocol extension to allow returning VSReferenceItem[] + + /// + /// Gets or sets the reference context. + /// + [DataMember(Name = "context")] + public ReferenceContext Context + { + get; + set; + } + + /// + /// Gets or sets the value of the PartialResultToken instance. + /// + [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Registration.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Registration.cs new file mode 100644 index 0000000000000..f53963b1c5746 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Registration.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the general registration information for registering for a capability. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Registration + { + /// + /// Gets or sets the id used to register the request. This can be used to deregister later. + /// + [DataMember(Name = "id")] + public string Id + { + get; + set; + } + + /// + /// Gets or sets the method / capability to register for. + /// + [DataMember(Name = "method")] + public string Method + { + get; + set; + } + + /// + /// Gets or sets the options necessary for registration. + /// + [DataMember(Name = "registerOptions")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? RegisterOptions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RegistrationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RegistrationParams.cs new file mode 100644 index 0000000000000..5368b992e0588 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RegistrationParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for the client/registerCapability request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RegistrationParams + { + /// + /// Gets or sets the set of capabilities that are being registered. + /// + [DataMember(Name = "registrations")] + public Registration[] Registrations + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedFullDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedFullDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..6a5792aaf0b25 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedFullDocumentDiagnosticReport.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a full diagnostic report with a set of related documents. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Full)] +public class RelatedFullDocumentDiagnosticReport : FullDocumentDiagnosticReport +{ + /// + /// Gets or sets the map of related document diagnostic reports. + /// + [DataMember(Name = "relatedDocuments")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Dictionary>? RelatedDocuments + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedUnchangedDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedUnchangedDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..dd7c784c4e9e2 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RelatedUnchangedDocumentDiagnosticReport.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing an unchanged diagnostic report with a set of related documents. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Unchanged)] +public class RelatedUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport +{ + /// + /// Gets or sets the map of related document diagnostic reports. + /// + [DataMember(Name = "relatedDocuments")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Dictionary>? RelatedDocuments + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameClientCapabilities.cs new file mode 100644 index 0000000000000..e1a7633b1248e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameClientCapabilities.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using System.Xml.Linq; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + using static System.Net.Mime.MediaTypeNames; + + /// + /// Class which represents renaming client capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RenameClientCapabilities : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating whether the client supports testing for validity of rename operations before execution. + /// + [DataMember(Name = "prepareSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PrepareSupport + { + get; + set; + } + + /// + /// Gets or sets the value indicating the default behavior used by the client when the (`{ defaultBehavior: boolean }`) + /// result is used in the 'textDocument/prepareRename' request. + /// + [DataMember(Name = "prepareSupportDefaultBehavior")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public PrepareSupportDefaultBehavior? PrepareSupportDefaultBehavior + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the client honors the change annotations in text edits and resource + /// operations returned via the rename request's workspace edit, by for example presenting the workspace edit in + /// the user interface and asking for confirmation. + /// + [DataMember(Name = "honorsChangeAnnotations")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool HonorsChangeAnnotations + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFile.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFile.cs new file mode 100644 index 0000000000000..0c009e769b676 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFile.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a rename file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [Kind("rename")] + public class RenameFile + { + /// + /// Gets the kind value. + /// + [DataMember(Name = "kind")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Member can't be static since it's part of the protocol")] + public string Kind => "rename"; + + /// + /// Gets or sets the old (existing) location. + /// + [DataMember(Name = "oldUri", IsRequired = true)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri OldUri + { + get; + set; + } + + /// + /// Gets or sets the new location. + /// + [DataMember(Name = "newUri", IsRequired = true)] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri NewUri + { + get; + set; + } + + /// + /// Gets or sets the rename options. + /// + [DataMember(Name = "options")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public RenameFileOptions? Options + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFileOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFileOptions.cs new file mode 100644 index 0000000000000..14ef57b13e85f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameFileOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for a create file operation. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RenameFileOptions + { + /// + /// Gets or sets a value indicating whether the rename should overwrite the target if it already exists. (Overwrite wins over ignoreIfExists). + /// + [DataMember(Name = "overwrite")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Overwrite + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the action should be ignored if the file already exists. + /// + [DataMember(Name = "ignoreIfExists")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool IgnoreIfExists + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameOptions.cs new file mode 100644 index 0000000000000..46c9acb6fc939 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameOptions.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the rename options for server capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RenameOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether renames should be checked and tested before being executed. + /// + [DataMember(Name = "prepareProvider")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PrepareProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameParams.cs new file mode 100644 index 0000000000000..7969584eab4ac --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the rename parameters for the textDocument/rename request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RenameParams : TextDocumentPositionParams + { + /// + /// Gets or sets the new name of the renamed symbol. + /// + [DataMember(Name = "newName")] + public string NewName + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameRange.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameRange.cs new file mode 100644 index 0000000000000..2271728f12da6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/RenameRange.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a possible result value of the 'textDocument/prepareRename' request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class RenameRange + { + /// + /// Gets or sets the range of the string to rename. + /// + [DataMember(Name = "range")] + [JsonProperty(Required = Required.Always)] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the placeholder text of the string content to be renamed. + /// + [DataMember(Name = "placeholder")] + [JsonProperty(Required = Required.Always)] + public string Placeholder + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResolveSupportSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResolveSupportSetting.cs new file mode 100644 index 0000000000000..926d9a4e7c209 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResolveSupportSetting.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents initialization setting for properties a client can resolve lazily on a completion item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ResolveSupportSetting + { + /// + /// Gets or sets a value indicating the properties that a client can resolve lazily. + /// + [DataMember(Name = "properties", IsRequired = true)] + public string[] Properties + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResourceOperationKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResourceOperationKind.cs new file mode 100644 index 0000000000000..67cecd871b987 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ResourceOperationKind.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Value representing the kind of resource operations supported by the client. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct ResourceOperationKind(string Value) : IStringEnum + { + /// + /// Supports creating new files and folders. + /// + public static readonly ResourceOperationKind Create = new("create"); + + /// + /// Supports renaming existing files and folders. + /// + public static readonly ResourceOperationKind Rename = new("rename"); + + /// + /// Supports deleting existing files and folders. + /// + public static readonly ResourceOperationKind Delete = new("delete"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SaveOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SaveOptions.cs new file mode 100644 index 0000000000000..e42a781a46b23 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SaveOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents save option configurations. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SaveOptions + { + /// + /// Gets or sets a value indicating whether clients include text content on save. + /// + [DataMember(Name = "includeText")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool IncludeText + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenFormat.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenFormat.cs new file mode 100644 index 0000000000000..14d31e6282f43 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenFormat.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Value representing the format used to describe semantic tokens. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct SemanticTokenFormat(string Value) : IStringEnum + { + /// + /// Tokens are described using relative positions. + /// + public static readonly SemanticTokenFormat Relative = new("relative"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenModifiers.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenModifiers.cs new file mode 100644 index 0000000000000..ac7e8bdfa539e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenModifiers.cs @@ -0,0 +1,81 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + + /// + /// Well-known semantic token modifiers. + /// + public static class SemanticTokenModifiers + { + /// + /// Semantic token modifier for 'declaration'. + /// + public const string Declaration = "declaration"; + + /// + /// Semantic token modifier for 'definition'. + /// + public const string Definition = "definition"; + + /// + /// Semantic token modifier for 'readonly'. + /// + public const string Readonly = "readonly"; + + /// + /// Semantic token modifier for 'static'. + /// + public const string Static = "static"; + + /// + /// Semantic token modifier for 'deprecated'. + /// + public const string Deprecated = "deprecated"; + + /// + /// Semantic token modifier for 'abstract'. + /// + public const string Abstract = "abstract"; + + /// + /// Semantic token modifier for 'async'. + /// + public const string Async = "async"; + + /// + /// Semantic token modifier for 'modification'. + /// + public const string Modification = "modification"; + + /// + /// Semantic token modifier for 'documentation'. + /// + public const string Documentation = "documentation"; + + /// + /// Semantic token modifier for 'defaultLibrary'. + /// + public const string DefaultLibrary = "defaultLibrary"; + + /// + /// Collection containing all well-known semantic tokens modifiers. + /// + public static readonly IReadOnlyList AllModifiers = new[] + { + Declaration, + Definition, + Readonly, + Static, + Deprecated, + Abstract, + Async, + Modification, + Documentation, + DefaultLibrary, + }; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenTypes.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenTypes.cs new file mode 100644 index 0000000000000..4f486912aa83e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokenTypes.cs @@ -0,0 +1,154 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + + /// + /// Well-known semantic tokens types. + /// + public static class SemanticTokenTypes + { + /// + /// Semantic token modifier for 'namespace'. + /// + public const string Namespace = "namespace"; + + /// + /// Semantic token modifier for 'type'. + /// + public const string Type = "type"; + + /// + /// Semantic token modifier for 'class'. + /// + public const string Class = "class"; + + /// + /// Semantic token modifier for 'enum'. + /// + public const string Enum = "enum"; + + /// + /// Semantic token modifier for 'interface'. + /// + public const string Interface = "interface"; + + /// + /// Semantic token modifier for 'struct'. + /// + public const string Struct = "struct"; + + /// + /// Semantic token modifier for 'typeParameter'. + /// + public const string TypeParameter = "typeParameter"; + + /// + /// Semantic token modifier for 'parameter'. + /// + public const string Parameter = "parameter"; + + /// + /// Semantic token modifier for 'variable'. + /// + public const string Variable = "variable"; + + /// + /// Semantic token modifier for 'property'. + /// + public const string Property = "property"; + + /// + /// Semantic token modifier for 'enumMember'. + /// + public const string EnumMember = "enumMember"; + + /// + /// Semantic token modifier for 'event'. + /// + public const string Event = "event"; + + /// + /// Semantic token modifier for 'function'. + /// + public const string Function = "function"; + + /// + /// Semantic token modifier for 'method'. + /// + public const string Method = "method"; + + /// + /// Semantic token modifier for 'macro'. + /// + public const string Macro = "macro"; + + /// + /// Semantic token modifier for 'keyword'. + /// + public const string Keyword = "keyword"; + + /// + /// Semantic token modifier for 'modifier'. + /// + public const string Modifier = "modifier"; + + /// + /// Semantic token modifier for 'comment'. + /// + public const string Comment = "comment"; + + /// + /// Semantic token modifier for 'string'. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Protocol defines this as String")] + public const string String = "string"; + + /// + /// Semantic token modifier for 'number'. + /// + public const string Number = "number"; + + /// + /// Semantic token modifier for 'regexp'. + /// + public const string Regexp = "regexp"; + + /// + /// Semantic token modifier for 'operator'. + /// + public const string Operator = "operator"; + + /// + /// Collection containing all well-known semantic tokens types. + /// + public static readonly IReadOnlyList AllTypes = new[] + { + Namespace, + Type, + Class, + Enum, + Interface, + Struct, + TypeParameter, + Parameter, + Variable, + Property, + EnumMember, + Event, + Function, + Method, + Macro, + Keyword, + Modifier, + Comment, + String, + Number, + Regexp, + Operator, + }; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokens.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokens.cs new file mode 100644 index 0000000000000..5da9aff01f509 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokens.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing response to semantic tokens messages. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokens + { + /// + /// Gets or sets a property that identifies this version of the document's semantic tokens. + /// + [DataMember(Name = "resultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ResultId { get; set; } + + /// + /// Gets or sets and array containing encoded semantic tokens data. + /// + [DataMember(Name = "data", IsRequired = true)] + public int[] Data { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDelta.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDelta.cs new file mode 100644 index 0000000000000..0b3f9021f7a59 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDelta.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Represents a response from a semantic tokens Document provider Edits request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensDelta + { + /// + /// Gets or sets the Id for the client's new version after applying all + /// edits to their current semantic tokens data. + /// + [DataMember(Name = "resultId")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ResultId { get; set; } + + /// + /// Gets or sets an array of edits to apply to a previous response from a + /// semantic tokens Document provider. + /// + [DataMember(Name = "edits", IsRequired = true)] + public SemanticTokensEdit[] Edits { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaParams.cs new file mode 100644 index 0000000000000..0f46399e8dafb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaParams.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Parameters for a request for Edits that can be applied to a previous response + /// from a semantic tokens Document provider. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensDeltaParams : ITextDocumentParams, IPartialResultParams + { + /// + /// Gets or sets an identifier for the document to fetch semantic tokens from. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets a property indicating the version of the semantic + /// tokens Document provider response that the edits will be applied to. + /// + [DataMember(Name = "previousResultId")] + public string PreviousResultId { get; set; } + + /// + /// Gets or sets the value of the Progress instance. + /// + [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaPartialResult.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaPartialResult.cs new file mode 100644 index 0000000000000..cf5332e8b3745 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensDeltaPartialResult.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Represents a response from a semantic tokens Document provider Edits request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensDeltaPartialResult + { + /// + /// Gets or sets an array of edits to apply to a previous response from a + /// semantic tokens Document provider. + /// + [DataMember(Name = "edits", IsRequired = true)] + public SemanticTokensEdit[] Edits { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensEdit.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensEdit.cs new file mode 100644 index 0000000000000..b72dd5895315d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensEdit.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing an individual edit incrementally applied to a previous + /// semantic tokens response from the Document provider. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1036:Override methods on comparable types", Justification = "Pending implementation of IComparable")] + public class SemanticTokensEdit : IComparable + { + /// + /// Gets or sets the position in the previous response's + /// to begin the edit. + /// + [DataMember(Name = "start")] + public int Start { get; set; } + + /// + /// Gets or sets the number of numbers to delete in the + /// from the previous response. + /// + [DataMember(Name = "deleteCount")] + public int DeleteCount { get; set; } + + /// + /// Gets or sets an array containing the encoded semantic tokens information to insert + /// into a previous response. + /// + [DataMember(Name = "data")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int[]? Data { get; set; } + + /// + /// Compares two s based on their order. + /// + /// The other edit. + /// -1 if this item comes first and 1 if it comes second. + public int CompareTo(SemanticTokensEdit? other) + => other is null ? -1 : this.Start.CompareTo(other.Start); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensFullOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensFullOptions.cs new file mode 100644 index 0000000000000..5e78174859d6d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensFullOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Options for the full document semantic tokens classification provider. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensFullOptions + { + /// + /// Gets or sets a value indicating whether the server supports deltas for full documents. + /// + [DataMember(Name = "delta")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Delta + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensLegend.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensLegend.cs new file mode 100644 index 0000000000000..d39c7aaf0501d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensLegend.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Legend used to encode semantic token types in . + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensLegend + { + /// + /// Gets or sets an array of token types that can be encoded in semantic tokens responses. + /// + [DataMember(Name = "tokenTypes")] + public string[] TokenTypes + { + get; + set; + } + + /// + /// Gets or sets an array of token modfiers that can be encoded in semantic tokens responses. + /// + [DataMember(Name = "tokenModifiers")] + public string[] TokenModifiers + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensOptions.cs new file mode 100644 index 0000000000000..56fe7437baad9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensOptions.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Initialization options for semantic tokens support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a legend describing how semantic token types and modifiers are encoded in responses. + /// + [DataMember(Name = "legend")] + public SemanticTokensLegend Legend { get; set; } + + /// + /// Gets or sets a value indicating whether semantic tokens Range provider requests are supported. + /// + [DataMember(Name = "range")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Range { get; set; } + + /// + /// Gets or sets whether or not the server supports providing semantic tokens for a full document. + /// + [DataMember(Name = "full")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Full { get; set; } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensParams.cs new file mode 100644 index 0000000000000..065094601f0ed --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensParams.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Parameters for semantic tokens full Document request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensParams : ITextDocumentParams, IPartialResultParams + { + /// + /// Gets or sets an identifier for the document to fetch semantic tokens from. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets the value of the Progress instance. + /// + [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensPartialResult.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensPartialResult.cs new file mode 100644 index 0000000000000..0dff8d9b3d79c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensPartialResult.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing response to semantic tokens messages. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensPartialResult + { + /// + /// Gets or sets and array containing encoded semantic tokens data. + /// + [DataMember(Name = "data", IsRequired = true)] + public int[] Data { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRangeParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRangeParams.cs new file mode 100644 index 0000000000000..622cb7705512d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRangeParams.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Parameters for the semantic tokens Range request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensRangeParams : SemanticTokensParams + { + /// + /// Gets or sets the range within the document to fetch semantic tokens for. + /// + [DataMember(Name = "range")] + public Range Range { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsFullSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsFullSetting.cs new file mode 100644 index 0000000000000..f1a0ae70d83ae --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsFullSetting.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Client settings for semantic tokens related to the + /// `textDocument/semanticTokens/full` message. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensRequestsFullSetting + { + /// + /// Gets or sets a value indicating whether the client will send the + /// textDocument/semanticTokens/full/delta request if the server + /// provides a corresponding handler. + /// + [DataMember(Name = "range")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Delta { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsSetting.cs new file mode 100644 index 0000000000000..150687257dd55 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensRequestsSetting.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Requests client settings for semantic tokens. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensRequestsSetting + { + /// + /// Gets or sets a value indicating whether the client will send the + /// `textDocument/semanticTokens/range` request if the server provides a + /// corresponding handler. + /// + [DataMember(Name = "range")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Range { get; set; } + + /// + /// Gets or sets a value indicating whether the client will send the + /// `textDocument/semanticTokens/full` request if the server provides a + /// corresponding handler. + /// + [DataMember(Name = "full")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Full { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensSetting.cs new file mode 100644 index 0000000000000..5f8ac1d408da1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensSetting.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Client settings for semantic tokens. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating which requests the client supports and might send to the server + /// depending on the server's capability. + /// + [DataMember(Name = "requests")] + public SemanticTokensRequestsSetting Requests { get; set; } + + /// + /// Gets or sets an array of token types supported by the client for encoding + /// semantic tokens. + /// + [DataMember(Name = "tokenTypes")] + public string[] TokenTypes { get; set; } + + /// + /// Gets or sets an array of token modifiers supported by the client for encoding + /// semantic tokens. + /// + [DataMember(Name = "tokenModifiers")] + public string[] TokenModifiers { get; set; } + + /// + /// Gets or sets an array of formats the clients supports. + /// + [DataMember(Name = "formats")] + public SemanticTokenFormat[] Formats { get; set; } + + /// + /// Gets or sets a value indicating whether the client supports tokens that can overlap each other. + /// + [DataMember(Name = "overlappingTokenSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool OverlappingTokenSupport { get; set; } + + /// + /// Gets or sets a value indicating whether the client supports tokens that can span multiple lines. + /// + [DataMember(Name = "multilineTokenSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool MultilineTokenSupport { get; set; } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensWorkspaceSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensWorkspaceSetting.cs new file mode 100644 index 0000000000000..9b9e65710269f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SemanticTokens/SemanticTokensWorkspaceSetting.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Capabilities specific to the semantic token requests scoped to the workspace. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SemanticTokensWorkspaceSetting + { + /// + /// Gets or sets a value indicating whether the client implementation + /// supports a refresh request sent from the server to the client. + /// + /// + /// Note that this event is global and will force the client to refresh all + /// semantic tokens currently shown.It should be used with absolute care + /// and is useful for situation where a server for example detect a project + /// wide change that requires such a calculation. + /// + [DataMember(Name = "refreshSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool RefreshSupport { get; set; } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ServerCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ServerCapabilities.cs new file mode 100644 index 0000000000000..aecf3aa065b99 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ServerCapabilities.cs @@ -0,0 +1,315 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Diagnostics.CodeAnalysis; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents server capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ServerCapabilities + { + /// + /// Gets or sets the value which indicates how text document are synced. + /// + [DataMember(Name = "textDocumentSync")] + [JsonConverter(typeof(TextDocumentSyncConverter))] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "There are no issues with this code")] + [SuppressMessage("Microsoft.StyleCop.CSharp.LayoutRules", "SA1500:BracesForMultiLineStatementsShouldNotShareLine", Justification = "There are no issues with this code")] + public TextDocumentSyncOptions? TextDocumentSync + { + get; + set; + } = new TextDocumentSyncOptions + { + OpenClose = true, + Change = TextDocumentSyncKind.None, + Save = new SaveOptions + { + IncludeText = false, + }, + }; + + /// + /// Gets or sets the value which indicates if completions are supported. + /// + [DataMember(Name = "completionProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionOptions? CompletionProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server provides hover support. + /// + [DataMember(Name = "hoverProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? HoverProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if signature help is supported. + /// + [DataMember(Name = "signatureHelpProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SignatureHelpOptions? SignatureHelpProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether go to definition is supported. + /// + [DataMember(Name = "definitionProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DefinitionProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether go to type definition is supported. + /// + [DataMember(Name = "typeDefinitionProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? TypeDefinitionProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether go to implementation is supported. + /// + [DataMember(Name = "implementationProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? ImplementationProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether find all references is supported. + /// + [DataMember(Name = "referencesProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? ReferencesProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports document highlight. + /// + [DataMember(Name = "documentHighlightProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DocumentHighlightProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether document symbols are supported. + /// + [DataMember(Name = "documentSymbolProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DocumentSymbolProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether code actions are supported. + /// + [DataMember(Name = "codeActionProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? CodeActionProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if code lens is supported. + /// + [DataMember(Name = "codeLensProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeLensOptions? CodeLensProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if document link is supported. + /// + [DataMember(Name = "documentLinkProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DocumentLinkOptions? DocumentLinkProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if document color is supported. + /// + [DataMember(Name = "colorProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DocumentColorProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether document formatting is supported. + /// + [DataMember(Name = "documentFormattingProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DocumentFormattingProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether document range formatting is supported. + /// + [DataMember(Name = "documentRangeFormattingProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? DocumentRangeFormattingProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if document on type formatting is supported. + /// + [DataMember(Name = "documentOnTypeFormattingProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DocumentOnTypeFormattingOptions? DocumentOnTypeFormattingProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether rename is supported. + /// + [DataMember(Name = "renameProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? RenameProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if folding range is supported. + /// + [DataMember(Name = "foldingRangeProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? FoldingRangeProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if execute command is supported. + /// + [DataMember(Name = "executeCommandProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ExecuteCommandOptions? ExecuteCommandProvider + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether workspace symbols are supported. + /// + [DataMember(Name = "workspaceSymbolProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? WorkspaceSymbolProvider + { + get; + set; + } + + /// + /// Gets or sets experimental server capabilities. + /// + [DataMember(Name = "experimental")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public object? Experimental + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether the server supports linked editing range. + /// + [DataMember(Name = "linkedEditingRangeProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? LinkedEditingRangeProvider + { + get; + set; + } + + /// + /// Gets or sets the value which indicates if semantic tokens is supported. + /// + [DataMember(Name = "semanticTokensProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SemanticTokensOptions? SemanticTokensOptions + { + get; + set; + } + + /// + /// Gets or sets the value which indicates what support the server has for pull diagnostics. + /// + [DataMember(Name = "diagnosticProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticOptions? DiagnosticOptions + { + get; + set; + } + + /// + /// Gets or sets the value which indicates what support the server has for inlay hints. + /// + [DataMember(Name = "inlayHintProvider")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? InlayHintOptions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageParams.cs new file mode 100644 index 0000000000000..843734912f55d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents parameter sent with window/showMessage requests. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ShowMessageParams + { + /// + /// Gets or sets the type of message. + /// + [DataMember(Name = "type")] + public MessageType MessageType + { + get; + set; + } + + /// + /// Gets or sets the message. + /// + [DataMember(Name = "message")] + public string Message + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageRequestParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageRequestParams.cs new file mode 100644 index 0000000000000..e44ebe3d14add --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/ShowMessageRequestParams.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents parameter sent with window/showMessageRequest requests. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class ShowMessageRequestParams : ShowMessageParams + { + /// + /// Gets or sets an array of s to present. + /// + [DataMember(Name = "actions")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public MessageActionItem[]? Actions + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelp.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelp.cs new file mode 100644 index 0000000000000..4f991f154cb7d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelp.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the signature of something callable. This class is returned from the textDocument/signatureHelp request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureHelp + { + /// + /// Gets or sets an array of signatures associated with the callable item. + /// + [DataMember(Name = "signatures")] + [JsonProperty(Required = Required.Always)] + public SignatureInformation[] Signatures + { + get; + set; + } + + /// + /// Gets or sets the active signature. If the value is omitted or falls outside the range of Signatures it defaults to zero. + /// + [DataMember(Name = "activeSignature")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? ActiveSignature + { + get; + set; + } + + /// + /// Gets or sets the active parameter. If the value is omitted or falls outside the range of Signatures[ActiveSignature].Parameters it defaults to zero. + /// + [DataMember(Name = "activeParameter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? ActiveParameter + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpContext.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpContext.cs new file mode 100644 index 0000000000000..a78cbfcd1e17d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpContext.cs @@ -0,0 +1,61 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing additional information about the context in which a signature help request is triggered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureHelpContext + { + /// + /// Gets or sets the indicating how the signature help was triggered. + /// + [DataMember(Name = "triggerKind")] + public SignatureHelpTriggerKind TriggerKind + { + get; + set; + } + + /// + /// Gets or sets the character that caused signature help to be triggered. + /// This value is null when triggerKind is not TriggerCharacter. + /// + [DataMember(Name = "triggerCharacter")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? TriggerCharacter + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether signature help was already showing when it was triggered. + /// + [DataMember(Name = "isRetrigger")] + public bool IsRetrigger + { + get; + set; + } + + /// + /// Gets or sets the currently active . + /// + [DataMember(Name = "activeSignatureHelp")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SignatureHelp? ActiveSignatureHelp + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpOptions.cs new file mode 100644 index 0000000000000..70e0b3d49574e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpOptions.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the options for signature help support. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureHelpOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets the characters that trigger signature help automatically. + /// + [DataMember(Name = "triggerCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? TriggerCharacters + { + get; + set; + } + + /// + /// Gets or sets the characters that re-trigger signature help + /// when signature help is already showing. + /// + [DataMember(Name = "retriggerCharacters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string[]? RetriggerCharacters + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpParams.cs new file mode 100644 index 0000000000000..1d06af8b73d33 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpParams.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the parameters for the textDocument/signatureHelp request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureHelpParams : TextDocumentPositionParams + { + /// + /// Gets or sets the signature help context. + /// + [DataMember(Name = "context")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SignatureHelpContext? Context + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpSetting.cs new file mode 100644 index 0000000000000..8c4d91b18c017 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpSetting.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the signature help initialization setting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureHelpSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets the information. + /// + [DataMember(Name = "signatureInformation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SignatureInformationSetting? SignatureInformation + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether additional context information + /// is supported for the `textDocument/signatureHelp` request. + /// + [DataMember(Name = "contextSupport")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ContextSupport + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpTriggerKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpTriggerKind.cs new file mode 100644 index 0000000000000..d6f5049b22e38 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureHelpTriggerKind.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum which represents the various ways in which completion can be triggered. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum SignatureHelpTriggerKind + { + /// + /// Signature help was invoked manually by the user or a command. + /// + Invoked = 1, + + /// + /// Signature help was triggered by a trigger character. + /// + TriggerCharacter = 2, + + /// + /// Signature help was triggered by the cursor moving or by the document content changing. + /// + ContentChange = 3, + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformation.cs new file mode 100644 index 0000000000000..4eead97f62872 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformation.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a single signature of a callable item. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureInformation + { + /// + /// Gets or sets the label of this signature. + /// + [DataMember(Name = "label")] + public string Label + { + get; + set; + } + + /// + /// Gets or sets the human-readable documentation of this signature. + /// + [DataMember(Name = "documentation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Documentation + { + get; + set; + } + + /// + /// Gets or sets the parameters of this signature. + /// + [DataMember(Name = "parameters")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ParameterInformation[]? Parameters + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformationSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformationSetting.cs new file mode 100644 index 0000000000000..370b61bc635fd --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SignatureInformationSetting.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the signature information initialization setting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SignatureInformationSetting + { + /// + /// Gets or sets the set of documentation formats the client supports. + /// + [DataMember(Name = "documentationFormat")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public MarkupKind[]? DocumentationFormat + { + get; + set; + } + + /// + /// Gets or sets the parameter information the client supports. + /// + [DataMember(Name = "parameterInformation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ParameterInformationSetting? ParameterInformation + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SumType.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SumType.cs new file mode 100644 index 0000000000000..3e68154f07b41 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SumType.cs @@ -0,0 +1,888 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using Newtonsoft.Json; + using System.Runtime.CompilerServices; + using Microsoft.CommonLanguageServerProtocol.Framework; + + /// + /// Struct that may contain a or a . + /// + /// The first type this struct is designed to contain. + /// The second type this struct is designed to contain. + [JsonConverter(typeof(SumConverter))] + public struct SumType : ISumType, IEquatable> + where T1 : notnull + where T2 : notnull + { + static SumType() + { + SumTypeUtils.ValidateTypeParameter(typeof(T1)); + SumTypeUtils.ValidateTypeParameter(typeof(T2)); + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T1 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T2 val) + { + this.Value = val; + } + + /// + public object? Value { get; } + + /// + /// Gets the value as the first specified type. + /// + public T1 First => (T1)this; + + /// + /// Gets the value as the second specified type. + /// + public T2 Second => (T2)this; + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType(T1 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T1? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType(T2 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T2? val) => val is null ? null : new SumType(val); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T1(SumType sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T2(SumType sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); + + public static bool operator ==(SumType left, SumType right) + { + return left.Equals(right); + } + + public static bool operator !=(SumType left, SumType right) + { + return !(left == right); + } + + /// + /// Tries to get the value as the first specified type. + /// + /// the value in the specified type. + /// if the type matches. + public bool TryGetFirst([MaybeNullWhen(false)] out T1 value) + { + if (this.Value is T1 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the second specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetSecond([MaybeNullWhen(false)] out T2 value) + { + if (this.Value is T2 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Runs a delegate corresponding to which type is contained inside this instance. + /// + /// The type that all the delegates will return. + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// + /// Delegate to handle the case where this instance is uninhabited. If this delegate isn't provided the default + /// will be returned instead. + /// + /// The instance created by the delegate corresponding to the current type stored in this instance. + public TResult Match(Func firstMatch, Func secondMatch, Func? defaultMatch = null) + { + if (firstMatch == null) + { + throw new ArgumentNullException(nameof(firstMatch)); + } + + if (secondMatch == null) + { + throw new ArgumentNullException(nameof(secondMatch)); + } + + if (this.Value is T1 tOne) + { + return firstMatch(tOne); + } + + if (this.Value is T2 tTwo) + { + return secondMatch(tTwo); + } + + if (defaultMatch != null) + { + return defaultMatch(); + } + +#pragma warning disable CS8603 // Possible null reference return. + return default(TResult); +#pragma warning restore CS8603 // Possible null reference return. + } + + /// + public override bool Equals(object obj) + { + return obj is SumType type && this.Equals(type); + } + + /// + public bool Equals(SumType other) + { + return EqualityComparer.Default.Equals(this.Value, other.Value); + } + + /// + public override int GetHashCode() + { + return -1937169414 + EqualityComparer.Default.GetHashCode(this.Value); + } + } + + /// + /// Struct that may contain a , a , or a . + /// + /// The first type this struct is designed to contain. + /// The second type this struct is designed to contain. + /// The third type this struct is designed to contain. + [JsonConverter(typeof(SumConverter))] + public struct SumType : ISumType, IEquatable> + where T1 : notnull + where T2 : notnull + where T3 : notnull + { + static SumType() + { + SumTypeUtils.ValidateTypeParameter(typeof(T1)); + SumTypeUtils.ValidateTypeParameter(typeof(T2)); + SumTypeUtils.ValidateTypeParameter(typeof(T3)); + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T1 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T2 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T3 val) + { + this.Value = val; + } + + /// + public object? Value { get; } + + /// + /// Gets the value as the first specified type. + /// + public T1 First => (T1)this; + + /// + /// Gets the value as the second specified type. + /// + public T2 Second => (T2)this; + + /// + /// Gets the value as the third specified type. + /// + public T3 Third => (T3)this; + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T1 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T1? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T2 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T2? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T3 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T3? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps an instance of with a . + /// + /// Sum instance to wrap. + public static implicit operator SumType(SumType sum) => + sum.Match( + (v) => new SumType(v), + (v) => new SumType(v)); + + /// + /// Attempts to cast an instance of into a . + /// + /// Sum instance to downcast. + public static explicit operator SumType(SumType sum) + { + if (sum.Value is T1 tOne) + { + return tOne; + } + + if (sum.Value is T2 tTwo) + { + return tTwo; + } + + throw new InvalidCastException(); + } + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T1(SumType sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T2(SumType sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T3(SumType sum) => sum.Value is T3 tVal ? tVal : throw new InvalidCastException(); + + public static bool operator ==(SumType left, SumType right) + { + return left.Equals(right); + } + + public static bool operator !=(SumType left, SumType right) + { + return !(left == right); + } + + /// + /// Tries to get the value as the first specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetFirst([MaybeNullWhen(false)] out T1 value) + { + if (this.Value is T1 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the second specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetSecond([MaybeNullWhen(false)] out T2 value) + { + if (this.Value is T2 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the third specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetThird([MaybeNullWhen(false)] out T3 value) + { + if (this.Value is T3 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Runs a delegate corresponding to which type is contained inside this instance. + /// + /// The type that all the delegates will return. + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// + /// Delegate to handle the case where this instance is uninhabited. If this delegate isn't provided the default + /// will be returned instead. + /// + /// The instance created by the delegate corresponding to the current type stored in this instance. + public TResult Match(Func firstMatch, Func secondMatch, Func thirdMatch, Func? defaultMatch = null) + { + if (firstMatch == null) + { + throw new ArgumentNullException(nameof(firstMatch)); + } + + if (secondMatch == null) + { + throw new ArgumentNullException(nameof(secondMatch)); + } + + if (thirdMatch == null) + { + throw new ArgumentNullException(nameof(thirdMatch)); + } + + if (this.Value is T1 tOne) + { + return firstMatch(tOne); + } + + if (this.Value is T2 tTwo) + { + return secondMatch(tTwo); + } + + if (this.Value is T3 tThree) + { + return thirdMatch(tThree); + } + + if (defaultMatch != null) + { + return defaultMatch(); + } + +#pragma warning disable CS8603 // Possible null reference return. + return default(TResult); +#pragma warning restore CS8603 // Possible null reference return. + } + + /// + public override bool Equals(object obj) + { + return obj is SumType type && this.Equals(type); + } + + /// + public bool Equals(SumType other) + { + return EqualityComparer.Default.Equals(this.Value, other.Value); + } + + /// + public override int GetHashCode() + { + return -1937169414 + EqualityComparer.Default.GetHashCode(this.Value); + } + } + + /// + /// Struct that may contain a , a , a , or a . + /// + /// The first type this struct is designed to contain. + /// The second type this struct is designed to contain. + /// The third type this struct is designed to contain. + /// The fourth type this struct is designed to contain. + [JsonConverter(typeof(SumConverter))] + public struct SumType : ISumType, IEquatable> + where T1 : notnull + where T2 : notnull + where T3 : notnull + where T4 : notnull + { + static SumType() + { + SumTypeUtils.ValidateTypeParameter(typeof(T1)); + SumTypeUtils.ValidateTypeParameter(typeof(T2)); + SumTypeUtils.ValidateTypeParameter(typeof(T3)); + SumTypeUtils.ValidateTypeParameter(typeof(T4)); + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T1 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T2 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T3 val) + { + this.Value = val; + } + + /// + /// Initializes a new instance of the struct containing a . + /// + /// The value to store in the . + public SumType(T4 val) + { + this.Value = val; + } + + /// + public object? Value { get; } + + /// + /// Gets the value as the first specified type. + /// + public T1 First => (T1)this; + + /// + /// Gets the value as the second specified type. + /// + public T2 Second => (T2)this; + + /// + /// Gets the value as the third specified type. + /// + public T3 Third => (T3)this; + + /// + /// Gets the value as the fourth specified type. + /// + public T4 Fourth => (T4)this; + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T1 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T1? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T2 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T2? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T3 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T3? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrap. + public static implicit operator SumType(T4 val) => new SumType(val); + + /// + /// Implicitly wraps a value of type with a . + /// + /// Value to be wrapped. + public static implicit operator SumType?(T4? val) => val is null ? null : new SumType(val); + + /// + /// Implicitly wraps an instance of with a . + /// + /// Sum instance to wrap. + public static implicit operator SumType(SumType sum) => + sum.Match( + (v) => new SumType(v), + (v) => new SumType(v)); + + /// + /// Implicitly wraps an instance of with a . + /// + /// Sum instance to wrap. + public static implicit operator SumType(SumType sum) => + sum.Match( + (v) => new SumType(v), + (v) => new SumType(v), + (v) => new SumType(v)); + + /// + /// Attempts to cast an instance of into a . + /// + /// Sum instance to downcast. + public static explicit operator SumType(SumType sum) + { + if (sum.Value is T1 tOne) + { + return tOne; + } + + if (sum.Value is T2 tTwo) + { + return tTwo; + } + + throw new InvalidCastException(); + } + + /// + /// Attempts to cast an instance of into a . + /// + /// Sum instance to downcast. + public static explicit operator SumType(SumType sum) + { + if (sum.Value is T1 tOne) + { + return tOne; + } + + if (sum.Value is T2 tTwo) + { + return tTwo; + } + + if (sum.Value is T3 tThree) + { + return tThree; + } + + throw new InvalidCastException(); + } + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T1(SumType sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T2(SumType sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T3(SumType sum) => sum.Value is T3 tVal ? tVal : throw new InvalidCastException(); + + /// + /// Attempts to cast an instance of to an instance of . + /// + /// Thrown if this instance of does not contain an instance of . + /// Instance to unwrap. + public static explicit operator T4(SumType sum) => sum.Value is T4 tVal ? tVal : throw new InvalidCastException(); + + public static bool operator ==(SumType left, SumType right) + { + return left.Equals(right); + } + + public static bool operator !=(SumType left, SumType right) + { + return !(left == right); + } + + /// + /// Tries to get the value as the first specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetFirst([MaybeNullWhen(false)] out T1 value) + { + if (this.Value is T1 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the second specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetSecond([MaybeNullWhen(false)] out T2 value) + { + if (this.Value is T2 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the third specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetThird([MaybeNullWhen(false)] out T3 value) + { + if (this.Value is T3 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Tries to get the value as the fourth specified type. + /// + /// the value in the specified type/>. + /// if the type matches. + public bool TryGetFourth([MaybeNullWhen(false)] out T4 value) + { + if (this.Value is T4 typeValue) + { + value = typeValue; + return true; + } + + value = default; + return false; + } + + /// + /// Runs a delegate corresponding to which type is contained inside this instance. + /// + /// The type that all the delegates will return. + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// Delegate to handle the case where this instance contains a . + /// + /// Delegate to handle the case where this instance is uninhabited. If this delegate isn't provided the default + /// will be returned instead. + /// + /// The instance created by the delegate corresponding to the current type stored in this instance. + public TResult Match(Func firstMatch, Func secondMatch, Func thirdMatch, Func fourthMatch, Func? defaultMatch = null) + { + if (firstMatch == null) + { + throw new ArgumentNullException(nameof(firstMatch)); + } + + if (secondMatch == null) + { + throw new ArgumentNullException(nameof(secondMatch)); + } + + if (thirdMatch == null) + { + throw new ArgumentNullException(nameof(thirdMatch)); + } + + if (fourthMatch == null) + { + throw new ArgumentNullException(nameof(fourthMatch)); + } + + if (this.Value is T1 tOne) + { + return firstMatch(tOne); + } + + if (this.Value is T2 tTwo) + { + return secondMatch(tTwo); + } + + if (this.Value is T3 tThree) + { + return thirdMatch(tThree); + } + + if (this.Value is T4 tFour) + { + return fourthMatch(tFour); + } + + if (defaultMatch != null) + { + return defaultMatch(); + } + +#pragma warning disable CS8603 // Possible null reference return. + return default(TResult); +#pragma warning restore CS8603 // Possible null reference return. + } + + /// + public override bool Equals(object obj) + { + return obj is SumType type && this.Equals(type); + } + + /// + public bool Equals(SumType other) + { + return EqualityComparer.Default.Equals(this.Value, other.Value); + } + + /// + public override int GetHashCode() + { + return -1937169414 + EqualityComparer.Default.GetHashCode(this.Value); + } + } + + /// + /// Utility methods for implementations. + /// + internal static class SumTypeUtils + { + /// + /// Validates that is a valid type parameter for a SumType. + /// + /// The type to validate. + /// If is not supported as a type parameter for a + /// SumType. + public static void ValidateTypeParameter(Type type) + { + if (typeof(ISumType).IsAssignableFrom(type)) + { + throw new NotSupportedException(LSPFrameworkResources.NestedSumType); + } + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolInformation.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolInformation.cs new file mode 100644 index 0000000000000..63fcb40193c78 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolInformation.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Collections.Generic; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing information about programming constructs like variables, classes, interfaces, etc. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SymbolInformation : IEquatable + { + /// + /// Gets or sets the name of this symbol. + /// + [DataMember(Name = "name")] + public string Name + { + get; + set; + } + + /// + /// Gets or sets the of this symbol. + /// + [DataMember(Name = "kind")] + public SymbolKind Kind + { + get; + set; + } + + /// + /// Gets or sets the of this symbol. + /// + [DataMember(Name = "location")] + public Location Location + { + get; + set; + } + + /// + /// Gets or sets the name of the symbol containing this symbol. + /// + [DataMember(Name = "containerName")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? ContainerName + { + get; + set; + } + + /// + public override bool Equals(object obj) + { + return this.Equals(obj as SymbolInformation); + } + + /// + public bool Equals(SymbolInformation? other) + { + return other != null && + this.Name == other.Name && + this.Kind == other.Kind && + EqualityComparer.Default.Equals(this.Location, other.Location) && + this.ContainerName == other.ContainerName; + } + + /// + public override int GetHashCode() + { + var hashCode = 1633890234; + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Name); + hashCode = (hashCode * -1521134295) + this.Kind.GetHashCode(); + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.Location); + hashCode = (hashCode * -1521134295) + EqualityComparer.Default.GetHashCode(this.ContainerName); + return hashCode; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKind.cs new file mode 100644 index 0000000000000..4e7eab89a1950 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKind.cs @@ -0,0 +1,149 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Enum which represents the various kinds of symbols. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Names are defined by the LSP")] + public enum SymbolKind + { + /// + /// Symbol is a file. + /// + File = 1, + + /// + /// Symbol is a module. + /// + Module = 2, + + /// + /// Symbol is a namespace. + /// + Namespace = 3, + + /// + /// Symbol is a package. + /// + Package = 4, + + /// + /// Symbol is a class. + /// + Class = 5, + + /// + /// Symbol is a method. + /// + Method = 6, + + /// + /// Symbol is a property. + /// + Property = 7, + + /// + /// Symbol is a field. + /// + Field = 8, + + /// + /// Symbol is a constructor. + /// + Constructor = 9, + + /// + /// Symbol is an enum. + /// + Enum = 10, + + /// + /// Symbol is an interface. + /// + Interface = 11, + + /// + /// Symbol is a function. + /// + Function = 12, + + /// + /// Symbol is a variable. + /// + Variable = 13, + + /// + /// Symbol is a constant. + /// + Constant = 14, + + /// + /// Symbol is a string. + /// + String = 15, + + /// + /// Symbol is a number. + /// + Number = 16, + + /// + /// Symbol is a boolean. + /// + Boolean = 17, + + /// + /// Symbol is an array. + /// + Array = 18, + + /// + /// Symbol is an object. + /// + Object = 19, + + /// + /// Symbol is a key. + /// + Key = 20, + + /// + /// Symbol is null. + /// + Null = 21, + + /// + /// Symbol is an enum member. + /// + EnumMember = 22, + + /// + /// Symbol is a struct. + /// + Struct = 23, + + /// + /// Symbol is an event. + /// + Event = 24, + + /// + /// Symbol is an operator. + /// + Operator = 25, + + /// + /// Symbol is a type parameter. + /// + TypeParameter = 26, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKindSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKindSetting.cs new file mode 100644 index 0000000000000..79f4613a716e4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolKindSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the symbol kind setting in initialization. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SymbolKindSetting + { + /// + /// Gets or sets the types of symbol kind the client supports. + /// + [DataMember(Name = "valueSet")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SymbolKind[]? ValueSet + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolSetting.cs new file mode 100644 index 0000000000000..2a29fd1cac5f4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SymbolSetting.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the symbol setting for initialization. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SymbolSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets the information. + /// + [DataMember(Name = "symbolKind")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SymbolKindSetting? SymbolKind + { + get; + set; + } + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SynchronizationSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SynchronizationSetting.cs new file mode 100644 index 0000000000000..43a8d61fa78db --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/SynchronizationSetting.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents synchronization initialization setting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class SynchronizationSetting : DynamicRegistrationSetting + { + /// + /// Gets or sets a value indicating whether WillSave event is supported. + /// + [DataMember(Name = "willSave")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WillSave + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether WillSaveWaitUntil event is supported. + /// + [DataMember(Name = "willSaveWaitUntil")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WillSaveWaitUntil + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether DidSave event is supported. + /// + [DataMember(Name = "didSave")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DidSave + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TagSupport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TagSupport.cs new file mode 100644 index 0000000000000..70e9eb53375b7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TagSupport.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TagSupport + { + /// + /// Gets or sets a value indicating the tags supported by the client. + /// + [DataMember(Name = "valueSet")] + public DiagnosticTag[] ValueSet + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentClientCapabilities.cs new file mode 100644 index 0000000000000..d8c04be5c1e54 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentClientCapabilities.cs @@ -0,0 +1,270 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents text document capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentClientCapabilities + { + /// + /// Gets or sets the synchronization setting. + /// + [DataMember(Name = "synchronization")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SynchronizationSetting? Synchronization + { + get; + set; + } + + /// + /// Gets or sets the completion setting. + /// + [DataMember(Name = "completion")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CompletionSetting? Completion + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if hover can be dynamically registered. + /// + [DataMember(Name = "hover")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public HoverSetting? Hover + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if signature help can be dynamically registered. + /// + [DataMember(Name = "signatureHelp")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SignatureHelpSetting? SignatureHelp + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if definition can be dynamically registered. + /// + [DataMember(Name = "definition")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? Definition + { + get; + set; + } + + /// + /// Gets or sets the settings which determines if type definition can be dynamically registered. + /// + [DataMember(Name = "typeDefinition")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? TypeDefinition + { + get; + set; + } + + /// + /// Gets or sets the settings which determines if implementation can be dynamically registered. + /// + [DataMember(Name = "implementation")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? Implementation + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if references can be dynamically registered. + /// + [DataMember(Name = "references")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? References + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if document highlight can be dynamically registered. + /// + [DataMember(Name = "documentHighlight")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? DocumentHighlight + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if document symbol can be dynamically registered. + /// + [DataMember(Name = "documentSymbol")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DocumentSymbolSetting? DocumentSymbol + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if code action can be dynamically registered. + /// + [DataMember(Name = "codeAction")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeActionSetting? CodeAction + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if code lens can be dynamically registered. + /// + [DataMember(Name = "codeLens")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? CodeLens + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if document link can be dynamically registered. + /// + [DataMember(Name = "documentLink")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? DocumentLink + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if formatting can be dynamically registered. + /// + [DataMember(Name = "formatting")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? Formatting + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if range formatting can be dynamically registered. + /// + [DataMember(Name = "rangeFormatting")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? RangeFormatting + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if on type formatting can be dynamically registered. + /// + [DataMember(Name = "onTypeFormatting")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? OnTypeFormatting + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if rename can be dynamically registered. + /// + [DataMember(Name = "rename")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public RenameClientCapabilities? Rename + { + get; + set; + } + + /// + /// Gets or sets the setting publish diagnostics setting. + /// + [DataMember(Name = "publishDiagnostics")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public PublishDiagnosticsSetting? PublishDiagnostics + { + get; + set; + } + + /// + /// Gets or sets the setting which determines how folding range is supported. + /// + [DataMember(Name = "foldingRange")] + public FoldingRangeSetting? FoldingRange + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if linked editing range can be dynamically registered. + /// + [DataMember(Name = "linkedEditingRange")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting LinkedEditingRange + { + get; + set; + } + + /// + /// Gets or sets a setting indicating whether semantic tokens is supported. + /// + [DataMember(Name = "semanticTokens")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SemanticTokensSetting? SemanticTokens + { + get; + set; + } + + /// + /// Gets or sets the setting which determines what support the client has for pull diagnostics. + /// + [DataMember(Name = "diagnostic")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticSetting? Diagnostic + { + get; + set; + } + + /// + /// Gets or sets the setting which determines what support the client has for pull diagnostics. + /// + [DataMember(Name = "inlayHint")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InlayHintSetting? InlayHint + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentContentChangeEvent.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentContentChangeEvent.cs new file mode 100644 index 0000000000000..5db6a77bf9d0f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentContentChangeEvent.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which encapsulates a text document changed event. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentContentChangeEvent + { + /// + /// Gets or sets the range of the text that was changed. + /// + [DataMember(Name = "range")] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the length of the range that got replaced. + /// + [DataMember(Name = "rangeLength")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int? RangeLength + { + get; + set; + } + + /// + /// Gets or sets the new text of the range/document. + /// + [DataMember(Name = "text")] + public string Text + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentEdit.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentEdit.cs new file mode 100644 index 0000000000000..454693c165ea4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentEdit.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing a set of changes to a single text document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentEdit + { + /// + /// Gets or sets a document identifier indication which document to apply the edits to. + /// + [DataMember(Name = "textDocument", IsRequired = true)] + public OptionalVersionedTextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the array of edits to be applied to the document. + /// + [DataMember(Name = "edits", IsRequired = true)] + public TextEdit[] Edits + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentIdentifier.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentIdentifier.cs new file mode 100644 index 0000000000000..e0e2354ce0595 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentIdentifier.cs @@ -0,0 +1,83 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which identifies a text document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentIdentifier : IEquatable + { + /// + /// Gets or sets the URI of the text document. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + public static bool operator ==(TextDocumentIdentifier? value1, TextDocumentIdentifier? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(TextDocumentIdentifier? value1, TextDocumentIdentifier? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(TextDocumentIdentifier other) + { + return other is not null + && this.Uri == other.Uri; + } + + /// + public override bool Equals(object obj) + { + if (obj is TextDocumentIdentifier other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return this.Uri == null ? 89 : this.Uri.GetHashCode(); + } + + /// + public override string ToString() + { + return this.Uri == null ? string.Empty : this.Uri.AbsolutePath; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentItem.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentItem.cs new file mode 100644 index 0000000000000..d12a63797133c --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentItem.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a text document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentItem + { + /// + /// Gets or sets the document URI. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the document language identifier. + /// + [DataMember(Name = "languageId")] + public string LanguageId + { + get; + set; + } + + /// + /// Gets or sets the document version. + /// + [DataMember(Name = "version")] + public int Version + { + get; + set; + } + + /// + /// Gets or sets the content of the opened text document. + /// + [DataMember(Name = "text")] + public string Text + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentPositionParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentPositionParams.cs new file mode 100644 index 0000000000000..7f7cae8919bcf --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentPositionParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents a position within a text document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentPositionParams : ITextDocumentPositionParams + { + /// + /// Gets or sets the value which identifies the document. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the value which indicates the position within the document. + /// + [DataMember(Name = "position")] + public Position Position + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentRegistrationOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentRegistrationOptions.cs new file mode 100644 index 0000000000000..60f57d23fba9f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentRegistrationOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing the registration options for many different text document functions. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentRegistrationOptions : ITextDocumentRegistrationOptions + { + /// + /// Gets or sets the document filters for this registration option. + /// + [DataMember(Name = "documentSelector")] + [JsonProperty(NullValueHandling = NullValueHandling.Include)] + public DocumentFilter[]? DocumentSelector + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSaveReason.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSaveReason.cs new file mode 100644 index 0000000000000..670f9ad4c5983 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSaveReason.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Enum representing the reason a document was saved. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum TextDocumentSaveReason + { + /// + /// Save was manually triggered. + /// + Manual = 1, + + /// + /// Save was automatic after some delay. + /// + AfterDelay = 2, + + /// + /// Save was automatic after the editor lost focus. + /// + FocusOut = 3, + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncKind.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncKind.cs new file mode 100644 index 0000000000000..bc7eb3766c3d4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncKind.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Enum which represents the various ways to sync text documents. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public enum TextDocumentSyncKind + { + /// + /// Documents should not be synced at all. + /// + None = 0, + + /// + /// Documents are synced by always sending the full text. + /// + Full = 1, + + /// + /// Documents are synced by sending only incremental updates. + /// + Incremental = 2, + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncOptions.cs new file mode 100644 index 0000000000000..1f9a820e49d36 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextDocumentSyncOptions.cs @@ -0,0 +1,75 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents configuration values indicating how text documents should be synced. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextDocumentSyncOptions + { + /// + /// Gets or sets a value indicating whether open and close notifications are sent to the server. + /// + [DataMember(Name = "openClose")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool OpenClose + { + get; + set; + } + + /// + /// Gets or sets the value indicating how text documents are synced with the server. + /// + [DataMember(Name = "change")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + [DefaultValue(TextDocumentSyncKind.None)] + public TextDocumentSyncKind? Change + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether 'will save' notifications are sent to the server. + /// + [DataMember(Name = "willSave")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WillSave + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether 'will save until' notifications are sent to the server. + /// + [DataMember(Name = "willSaveWaitUntil")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WillSaveWaitUntil + { + get; + set; + } + + /// + /// Gets or sets a value indicating whether save notifications are sent to the server. + /// + [DataMember(Name = "save")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType? Save + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextEdit.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextEdit.cs new file mode 100644 index 0000000000000..319debd9305da --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TextEdit.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class which represents a text edit to a document. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TextEdit + { + /// + /// Gets or sets the value which indicates the range of the text edit. + /// + [DataMember(Name = "range", IsRequired = true)] + public Range Range + { + get; + set; + } + + /// + /// Gets or sets the value of the new text. + /// + [DataMember(Name = "newText")] + public string NewText + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TraceSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TraceSetting.cs new file mode 100644 index 0000000000000..4910338735f48 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TraceSetting.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.ComponentModel; + using Newtonsoft.Json; + + /// + /// Value representing the language server trace setting. + /// + /// See the Language Server Protocol specification for additional information. + /// + [JsonConverter(typeof(StringEnumConverter))] + [TypeConverter(typeof(StringEnumConverter.TypeConverter))] + public readonly record struct TraceSetting(string Value) : IStringEnum + { + /// + /// Setting for 'off'. + /// + public static readonly TraceSetting Off = new("off"); + + /// + /// Setting for 'messages'. + /// + public static readonly TraceSetting Messages = new("messages"); + + /// + /// Setting for 'verbose'. + /// + public static readonly TraceSetting Verbose = new("verbose"); + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TypeDefinitionOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TypeDefinitionOptions.cs new file mode 100644 index 0000000000000..616b928d5b860 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/TypeDefinitionOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class TypeDefinitionOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnchangedDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnchangedDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..959469792d4d6 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnchangedDocumentDiagnosticReport.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Runtime.Serialization; + +/// +/// Class representing a diagnostic report indicating that the last returned report is still accurate. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Unchanged)] +public class UnchangedDocumentDiagnosticReport +{ + /// + /// Gets the kind of this report. + /// + [DataMember(Name = "kind")] + public string Kind => DocumentDiagnosticReportKind.Unchanged; + + /// + /// Gets or sets the optional result id. + /// + [DataMember(Name = "resultId")] + public string ResultId + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Unregistration.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Unregistration.cs new file mode 100644 index 0000000000000..21c222e12fb83 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/Unregistration.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the information needed for unregistering a capability. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class Unregistration + { + /// + /// Gets or sets the id of the unregistration. + /// + [DataMember(Name = "id")] + public string Id + { + get; + set; + } + + /// + /// Gets or sets the method to unregister. + /// + [DataMember(Name = "method")] + public string Method + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnregistrationParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnregistrationParams.cs new file mode 100644 index 0000000000000..24fe4f9345c52 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/UnregistrationParams.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameter sent for the client/unregisterCapability request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class UnregistrationParams + { + /// + /// Gets or sets the capabilities to unregister. + /// + [DataMember(Name = "unregistrations")] + public Unregistration[] Unregistrations + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/VersionedTextDocumentIdentifier.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/VersionedTextDocumentIdentifier.cs new file mode 100644 index 0000000000000..fb713a0840240 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/VersionedTextDocumentIdentifier.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Globalization; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents a text document, but has a version identifier. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class VersionedTextDocumentIdentifier : TextDocumentIdentifier, IEquatable + { + /// + /// Gets or sets the version of the document. + /// + [DataMember(Name = "version")] + public int Version + { + get; + set; + } + + public static bool operator ==(VersionedTextDocumentIdentifier? value1, VersionedTextDocumentIdentifier? value2) + { + if (ReferenceEquals(value1, value2)) + { + return true; + } + + // Is null? + if (ReferenceEquals(null, value2)) + { + return false; + } + + return value1?.Equals(value2) ?? false; + } + + public static bool operator !=(VersionedTextDocumentIdentifier? value1, VersionedTextDocumentIdentifier? value2) + { + return !(value1 == value2); + } + + /// + public bool Equals(VersionedTextDocumentIdentifier other) + { + return other is not null + && this.Version == other.Version + && base.Equals(other); + } + + /// + public override bool Equals(object obj) + { + if (obj is VersionedTextDocumentIdentifier other) + { + return this.Equals(other); + } + else + { + return false; + } + } + + /// + public override int GetHashCode() + { + return this.Version.GetHashCode() + ^ (base.GetHashCode() * 79); + } + + /// + public override string ToString() + { + // Invariant culture because the culture on the server vs client may vary. + return base.ToString() + "|" + this.Version.ToString(CultureInfo.InvariantCulture); + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WillSaveTextDocumentParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WillSaveTextDocumentParams.cs new file mode 100644 index 0000000000000..fa29e8a1b0900 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WillSaveTextDocumentParams.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + + /// + /// Class representing the parameters sent for the textDocument/willSave request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WillSaveTextDocumentParams : ITextDocumentParams + { + /// + /// Gets or sets the representing the document to be saved. + /// + [DataMember(Name = "textDocument")] + public TextDocumentIdentifier TextDocument + { + get; + set; + } + + /// + /// Gets or sets the reason that the text document was saved. + /// + [DataMember(Name = "reason")] + public TextDocumentSaveReason Reason + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceClientCapabilities.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceClientCapabilities.cs new file mode 100644 index 0000000000000..df849d582bf12 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceClientCapabilities.cs @@ -0,0 +1,139 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WorkspaceClientCapabilities + { + /// + /// Gets or sets a value indicating whether apply edit is supported. + /// + [DataMember(Name = "applyEdit")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ApplyEdit + { + get; + set; + } + + /// + /// Gets or sets the workspace edit setting. + /// + [DataMember(Name = "workspaceEdit")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public WorkspaceEditSetting? WorkspaceEdit + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if did change configuration can be dynamically registered. + /// + [DataMember(Name = "didChangeConfiguration")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? DidChangeConfiguration + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if did change watched files can be dynamically registered. + /// + [DataMember(Name = "didChangeWatchedFiles")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? DidChangeWatchedFiles + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if symbols can be dynamically registered. + /// + [DataMember(Name = "symbol")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SymbolSetting? Symbol + { + get; + set; + } + + /// + /// Gets or sets the setting which determines if execute command can be dynamically registered. + /// + [DataMember(Name = "executeCommand")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DynamicRegistrationSetting? ExecuteCommand + { + get; + set; + } + + /// + /// Gets or sets capabilities specific to the semantic token requests scoped to the workspace. + /// + [DataMember(Name = "semanticTokens")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SemanticTokensWorkspaceSetting? SemanticTokens + { + get; + set; + } + + /// + /// Gets or sets capabilities indicating what support the client has for workspace pull diagnostics. + /// + [DataMember(Name = "diagnostics")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public DiagnosticWorkspaceSetting? Diagnostics + { + get; + set; + } + + /// + /// Gets or sets the capabilities if client support 'workspace/configuration' requests. + /// + [DataMember(Name = "configuration")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool Configuration + { + get; + set; + } + + /// + /// Gets of sets capabilities specific to the inlay hint requests scoped to the workspace. + /// + [DataMember(Name = "inlayHint")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public InlayHintWorkspaceSetting? InlayHint + { + get; + set; + } + + /// + /// Gets of sets capabilities specific to the code lens requests scoped to the workspace. + /// + [DataMember(Name = "codeLens")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public CodeLensWorkspaceSetting? CodeLens + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticParams.cs new file mode 100644 index 0000000000000..488a3390e21cb --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticParams.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing the workspace diagnostic request parameters +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Note that the first literal send needs to be a +/// followed by n literals. +/// +[DataContract] +public class WorkspaceDiagnosticParams : IPartialResultParams> +{ + /// + /// Gets or sets the value of the Progress instance. + /// + [DataMember(Name = Methods.PartialResultTokenName, IsRequired = false)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress>? PartialResultToken + { + get; + set; + } + + /// + /// Gets or sets the identifier for which the client is requesting diagnostics for. + /// + [DataMember(Name = "identifier")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string? Identifier + { + get; + set; + } + + /// + /// Gets or sets the result id of a previous diagnostics response if provided. + /// + [DataMember(Name = "previousResultIds")] + public PreviousResultId[] PreviousResultId + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReport.cs new file mode 100644 index 0000000000000..3465fd4401575 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReport.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a workspace diagnostic report. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class WorkspaceDiagnosticReport +{ + /// + /// Gets or sets the items in this diagnostic report. + /// + [DataMember(Name = "items")] + public SumType[] Items + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReportPartialResult.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReportPartialResult.cs new file mode 100644 index 0000000000000..9ce0b90ff0a6e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceDiagnosticReportPartialResult.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a partial result for a workspace diagnostic report. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +public class WorkspaceDiagnosticReportPartialResult +{ + /// + /// Gets or sets the items in this diagnostic report. + /// + [DataMember(Name = "items")] + public SumType[] Items + { + get; + set; + } +} \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEdit.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEdit.cs new file mode 100644 index 0000000000000..662a22f933219 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEdit.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Collections.Generic; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class representing a request sent from a language server to modify resources in the workspace. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WorkspaceEdit + { + /// + /// Gets or sets a dictionary holding changes to existing resources. + /// + [DataMember(Name = "changes")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public Dictionary? Changes + { + get; + set; + } + + /// + /// Gets or sets an array representing versioned document changes. + /// + [DataMember(Name = "documentChanges")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public SumType[]>? DocumentChanges + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEditSetting.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEditSetting.cs new file mode 100644 index 0000000000000..a98efaf4231a7 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceEditSetting.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents initialization settings for workspace edit. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WorkspaceEditSetting + { + /// + /// Gets or sets a value indicating whether document changes event is supported. + /// + [DataMember(Name = "documentChanges")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool DocumentChanges + { + get; + set; + } + + /// + /// GEts or sets the resource operations the client supports. + /// + [DataMember(Name = "resourceOperations")] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public ResourceOperationKind[]? ResourceOperations + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceFullDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceFullDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..ab82b7ebd7505 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceFullDocumentDiagnosticReport.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a full document diagnostic report for workspace diagnostic result. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Full)] +public class WorkspaceFullDocumentDiagnosticReport : FullDocumentDiagnosticReport +{ + /// + /// Gets or sets the URI associated with this diagnostic report. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the version number for which the diagnostics are reported. + /// If the document is not marked as open 'null' can be provided. + /// + [DataMember(Name = "version")] + public int? Version + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolOptions.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolOptions.cs new file mode 100644 index 0000000000000..3050186c285b4 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolOptions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents workspace symbols capabilities. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WorkspaceSymbolOptions : IWorkDoneProgressOptions + { + /// + /// Gets or sets a value indicating whether work done progress is supported. + /// + [DataMember(Name = "workDoneProgress")] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool WorkDoneProgress + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolParams.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolParams.cs new file mode 100644 index 0000000000000..f44303be1b9b1 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceSymbolParams.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol +{ + using System; + using System.Runtime.Serialization; + using Newtonsoft.Json; + + /// + /// Class which represents the parameter that's sent with the 'workspace/symbol' request. + /// + /// See the Language Server Protocol specification for additional information. + /// + [DataContract] + public class WorkspaceSymbolParams : IPartialResultParams + { + /// + /// Gets or sets the query (a non-empty string). + /// + [DataMember(Name = "query")] + public string Query + { + get; + set; + } + + /// + /// Gets or sets the value of the Progress instance. + /// + [DataMember(Name = Methods.PartialResultTokenName)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public IProgress? PartialResultToken + { + get; + set; + } + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceUnchangedDocumentDiagnosticReport.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceUnchangedDocumentDiagnosticReport.cs new file mode 100644 index 0000000000000..063e9505edd5e --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/WorkspaceUnchangedDocumentDiagnosticReport.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +/// +/// Class representing a unchanged document diagnostic report for workspace diagnostic result. +/// +/// See the Language Server Protocol specification for additional information. +/// +[DataContract] +[Kind(DocumentDiagnosticReportKind.Unchanged)] +public class WorkspaceUnchangedDocumentDiagnosticReport : UnchangedDocumentDiagnosticReport +{ + /// + /// Gets or sets the URI associated with this diagnostic report. + /// + [DataMember(Name = "uri")] + [JsonConverter(typeof(DocumentUriConverter))] + public Uri Uri + { + get; + set; + } + + /// + /// Gets or sets the version number for which the diagnostics are reported. + /// If the document is not marked as open 'null' can be provided. + /// + [DataMember(Name = "version")] + public int? Version + { + get; + set; + } +} diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.cs.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.cs.xlf new file mode 100644 index 0000000000000..ac445cd3039c9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.cs.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.de.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.de.xlf new file mode 100644 index 0000000000000..83fa691c9f6e9 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.de.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.es.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.es.xlf new file mode 100644 index 0000000000000..5c46b41f26f45 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.es.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.fr.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.fr.xlf new file mode 100644 index 0000000000000..2e20e4a3055ae --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.fr.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.it.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.it.xlf new file mode 100644 index 0000000000000..fe05ff652f7cf --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.it.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ja.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ja.xlf new file mode 100644 index 0000000000000..3d48c2e5ab0ba --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ja.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ko.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ko.xlf new file mode 100644 index 0000000000000..e46f273675690 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ko.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pl.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pl.xlf new file mode 100644 index 0000000000000..cd4c0e191952a --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pl.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pt-BR.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pt-BR.xlf new file mode 100644 index 0000000000000..2ef659b73389d --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.pt-BR.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ru.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ru.xlf new file mode 100644 index 0000000000000..35165d53b051f --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.ru.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.tr.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.tr.xlf new file mode 100644 index 0000000000000..8bf920aad68c0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.tr.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hans.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hans.xlf new file mode 100644 index 0000000000000..e89fb20e578c0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hans.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hant.xlf b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hant.xlf new file mode 100644 index 0000000000000..6aa68670d2ba0 --- /dev/null +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/xlf/LSPFrameworkResources.zh-Hant.xlf @@ -0,0 +1,42 @@ + + + + + + Unable to deserialize Uri. Unexpected value encountered: {0} + Unable to deserialize Uri. Unexpected value encountered: {0} + + + + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + Unable to deserialize MarkupContent. Unexpected value encountered: {0} + + + + A SumType cannot have another SumType as type parameter. + A SumType cannot have another SumType as type parameter. + + + + None of the SumType type parameters could be deserialized + None of the SumType type parameters could be deserialized + + + + Type {0} is missing a contructor that takes a single string as parameter. + Type {0} is missing a contructor that takes a single string as parameter. + + + + Unable to deserialize string-based enum. Unexpected data encountered: {0} + Unable to deserialize string-based enum. Unexpected data encountered: {0} + + + + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0} + + + + + \ No newline at end of file diff --git a/src/Features/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs b/src/Features/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs index 66bc7aeb5d53e..3174b48ed5833 100644 --- a/src/Features/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs +++ b/src/Features/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { @@ -57,7 +57,7 @@ public ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) capabilities.RenameProvider = true; capabilities.ImplementationProvider = true; capabilities.CodeActionProvider = new CodeActionOptions { CodeActionKinds = new[] { CodeActionKind.QuickFix, CodeActionKind.Refactor }, ResolveProvider = true }; - capabilities.CompletionProvider = new VisualStudio.LanguageServer.Protocol.CompletionOptions + capabilities.CompletionProvider = new Roslyn.LanguageServer.Protocol.CompletionOptions { ResolveProvider = true, AllCommitCharacters = commitCharacters, diff --git a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs index 53da6d3deb3e2..28870a7332e1c 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs @@ -13,8 +13,8 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text.Adornments; +using Roslyn.LanguageServer.Protocol; +using Roslyn.Text.Adornments; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer diff --git a/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs b/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs index 54eb27da30665..7446b2c8eebab 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs @@ -21,10 +21,10 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Tags; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text.Adornments; +using Roslyn.Text.Adornments; using Roslyn.Utilities; using Logger = Microsoft.CodeAnalysis.Internal.Log.Logger; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { diff --git a/src/Features/LanguageServer/Protocol/Handler/AbstractRefreshQueue.cs b/src/Features/LanguageServer/Protocol/Handler/AbstractRefreshQueue.cs index 0935cf7cbbfea..3a686b98a4eba 100644 --- a/src/Features/LanguageServer/Protocol/Handler/AbstractRefreshQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/AbstractRefreshQueue.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Collections; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/Breakpoints/ValidateBreakableRangeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Breakpoints/ValidateBreakableRangeHandler.cs index 23f7e327e8e40..7ba5975703810 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Breakpoints/ValidateBreakableRangeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Breakpoints/ValidateBreakableRangeHandler.cs @@ -10,9 +10,9 @@ using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/ClientCapabilitiesManager.cs b/src/Features/LanguageServer/Protocol/Handler/ClientCapabilitiesManager.cs index 32381f69a0a12..25acdda49028f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ClientCapabilitiesManager.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ClientCapabilitiesManager.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs index 3f266525d0c86..cab520ad343e7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs @@ -13,10 +13,10 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.UnifiedSuggestions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; using CodeAction = Microsoft.CodeAnalysis.CodeActions.CodeAction; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions { diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs index c40ce54892ea7..fe519739d5f2f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions { diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHandler.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHandler.cs index 9ac0b9bf8605c..27cea1c9b3f25 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHandler.cs @@ -18,10 +18,10 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs index 3a56b88cfe30c..a1be80086738c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionsHandler.cs @@ -12,9 +12,9 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs index d7c4240d565ba..a7c87dfdc90d3 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens; diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueue.cs b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueue.cs index 890c9f94ef16d..7d5c3b3b2e5e7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueue.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens { diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveData.cs b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveData.cs index 312bd6800008d..84d82992818e4 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveData.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveData.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens; diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs index fc65f3f04a01d..e53426791dc9f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensResolveHandler.cs @@ -10,7 +10,7 @@ using Roslyn.Utilities; using StreamJsonRpc; using Microsoft.CodeAnalysis.Shared.Extensions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens; diff --git a/src/Features/LanguageServer/Protocol/Handler/Commands/AbstractExecuteWorkspaceCommandHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Commands/AbstractExecuteWorkspaceCommandHandler.cs index c362a9c410414..ef15b8f6b2135 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Commands/AbstractExecuteWorkspaceCommandHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Commands/AbstractExecuteWorkspaceCommandHandler.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Commands { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs index b6c2785ef5eb7..0f92f7eea818b 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs @@ -18,7 +18,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionCapabilityHelper.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionCapabilityHelper.cs index 9892f33d66cd1..bd565c39807ac 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionCapabilityHelper.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionCapabilityHelper.cs @@ -7,7 +7,7 @@ using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs index 2741c24cd9d4f..300ae29ee9cba 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionListCache.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionListCache.cs index f889391bac0a3..6e27d07d63820 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionListCache.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionListCache.cs @@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis.Completion; using static Microsoft.CodeAnalysis.LanguageServer.Handler.Completion.CompletionListCache; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveData.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveData.cs index ae7d7f77a6e55..feb3d28077bc8 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveData.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveData.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs index 5160438651564..71334c12f208f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs @@ -13,7 +13,7 @@ using Microsoft.CommonLanguageServerProtocol.Framework; using Newtonsoft.Json.Linq; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/DefaultLspCompletionResultCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/DefaultLspCompletionResultCreationService.cs index cf0262481470a..d3b8fe4f80e0e 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/DefaultLspCompletionResultCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/DefaultLspCompletionResultCreationService.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion { diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/ILspCompletionResultCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/ILspCompletionResultCreationService.cs index b197f18bcea41..755d8e8f90813 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/ILspCompletionResultCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/ILspCompletionResultCreationService.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Text; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Completion { diff --git a/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler.cs index 8d7e1def02184..3739dd85989b7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler.cs @@ -11,10 +11,10 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Configuration { diff --git a/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OnInitialized.cs b/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OnInitialized.cs index 3c8a1c98199ba..36bc0e5f38d94 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OnInitialized.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Configuration/DidChangeConfigurationNotificationHandler_OnInitialized.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Configuration diff --git a/src/Features/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs index 7e4c51e8713cb..7dd090db7bd83 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs @@ -13,8 +13,8 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs index b79a4f99cea20..b25d426dd96ff 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToDefinitionHandler.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MetadataAsSource; using Microsoft.CodeAnalysis.Options; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs index 34c0540522c9f..969b512be3f27 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Definitions/GoToTypeDefinitionHandler.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MetadataAsSource; using Microsoft.CodeAnalysis.Options; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index 6f0a770f4fadb..c5514cb518025 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -14,9 +14,9 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics { diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractDocumentDiagnosticSource.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractDocumentDiagnosticSource.cs index 24b67899853c9..9b3fb5143adea 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractDocumentDiagnosticSource.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/AbstractDocumentDiagnosticSource.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics; diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/IDiagnosticSource.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/IDiagnosticSource.cs index a593bd9e797e3..e08a04e4ebae0 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/IDiagnosticSource.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/IDiagnosticSource.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics; diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/ProjectDiagnosticSource.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/ProjectDiagnosticSource.cs index 9ab028f945b1b..dbb3414f590f6 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/ProjectDiagnosticSource.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticSources/ProjectDiagnosticSource.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics; diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs index c06bc461d1415..44e4f3e3ac3b7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics; diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs index 97cfd5ead2fb0..79dbf506eb953 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics @@ -32,7 +32,7 @@ public DocumentPullDiagnosticHandler( public override TextDocumentIdentifier? GetTextDocumentIdentifier(VSInternalDocumentDiagnosticsParams diagnosticsParams) => diagnosticsParams.TextDocument; - protected override VSInternalDiagnosticReport[] CreateReport(TextDocumentIdentifier identifier, VisualStudio.LanguageServer.Protocol.Diagnostic[]? diagnostics, string? resultId) + protected override VSInternalDiagnosticReport[] CreateReport(TextDocumentIdentifier identifier, Roslyn.LanguageServer.Protocol.Diagnostic[]? diagnostics, string? resultId) => new[] { new VSInternalDiagnosticReport diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticHandlerFactory.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticHandlerFactory.cs index baade1214bde0..c8ebd1d256f50 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticHandlerFactory.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticHandlerFactory.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public; diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticsHandler.cs index af74b572008ac..ce52a958d76c7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicDocumentPullDiagnosticsHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public; @@ -46,7 +46,7 @@ protected override DiagnosticTag[] ConvertTags(DiagnosticData diagnosticData) return ConvertTags(diagnosticData, potentialDuplicate: false); } - protected override DocumentDiagnosticPartialReport CreateReport(TextDocumentIdentifier identifier, VisualStudio.LanguageServer.Protocol.Diagnostic[] diagnostics, string resultId) + protected override DocumentDiagnosticPartialReport CreateReport(TextDocumentIdentifier identifier, Roslyn.LanguageServer.Protocol.Diagnostic[] diagnostics, string resultId) => new DocumentDiagnosticPartialReport(new RelatedFullDocumentDiagnosticReport { ResultId = resultId, @@ -57,7 +57,7 @@ protected override DocumentDiagnosticPartialReport CreateRemovedReport(TextDocum => new DocumentDiagnosticPartialReport(new RelatedFullDocumentDiagnosticReport { ResultId = null, - Items = Array.Empty(), + Items = Array.Empty(), }); protected override DocumentDiagnosticPartialReport CreateUnchangedReport(TextDocumentIdentifier identifier, string resultId) diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicWorkspacePullDiagnosticsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicWorkspacePullDiagnosticsHandler.cs index 96149017fbc0c..14ebed5702c11 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicWorkspacePullDiagnosticsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Public/PublicWorkspacePullDiagnosticsHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public; @@ -67,7 +67,7 @@ protected override DiagnosticTag[] ConvertTags(DiagnosticData diagnosticData) return ConvertTags(diagnosticData, potentialDuplicate: false); } - protected override WorkspaceDiagnosticPartialReport CreateReport(TextDocumentIdentifier identifier, VisualStudio.LanguageServer.Protocol.Diagnostic[] diagnostics, string resultId) + protected override WorkspaceDiagnosticPartialReport CreateReport(TextDocumentIdentifier identifier, Roslyn.LanguageServer.Protocol.Diagnostic[] diagnostics, string resultId) => new WorkspaceDiagnosticPartialReport(new WorkspaceDiagnosticReport { Items = new SumType[] @@ -91,7 +91,7 @@ protected override WorkspaceDiagnosticPartialReport CreateRemovedReport(TextDocu new WorkspaceFullDocumentDiagnosticReport { Uri = identifier.Uri, - Items = Array.Empty(), + Items = Array.Empty(), // The documents provided by workspace reports are never open, so we return null. Version = null, ResultId = null, diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticCategories.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticCategories.cs index 8215fd50ca8b0..08622d0aa6dac 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticCategories.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticCategories.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics { diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs index 3ced29d52f60f..25e22d687eeaa 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs @@ -15,7 +15,7 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.TaskList; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics @@ -31,7 +31,7 @@ public WorkspacePullDiagnosticHandler(IDiagnosticAnalyzerService analyzerService protected override string? GetDiagnosticCategory(VSInternalWorkspaceDiagnosticsParams diagnosticsParams) => diagnosticsParams.QueryingDiagnosticKind?.Value; - protected override VSInternalWorkspaceDiagnosticReport[] CreateReport(TextDocumentIdentifier identifier, VisualStudio.LanguageServer.Protocol.Diagnostic[]? diagnostics, string? resultId) + protected override VSInternalWorkspaceDiagnosticReport[] CreateReport(TextDocumentIdentifier identifier, Roslyn.LanguageServer.Protocol.Diagnostic[]? diagnostics, string? resultId) => new[] { new VSInternalWorkspaceDiagnosticReport { diff --git a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidChangeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidChangeHandler.cs index 6a8f66ffbfc65..bdc89b3fe4e24 100644 --- a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidChangeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidChangeHandler.cs @@ -8,9 +8,9 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges { diff --git a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs index ac24eda1eb34b..ca5a669a17aec 100644 --- a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidCloseHandler.cs @@ -8,8 +8,8 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges { diff --git a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs index 4493969a86c3b..54a811861cab1 100644 --- a/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges { diff --git a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs index e211bc1ad7b54..ae97aa57532fc 100644 --- a/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Structure; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs b/src/Features/LanguageServer/Protocol/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs index bb052fa7e9d93..d91d1c14d3732 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs index f95e6f68c3c2e..e17382ddc9e50 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs index adeabd78172f9..799ebc0ccfef4 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentOnTypeHandler.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs index 09a2991bfb2b5..dce2297839510 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Formatting/FormatDocumentRangeHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs index be4f535b57a80..74dab558fc6f8 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Highlights/DocumentHighlightHandler.cs @@ -15,7 +15,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs index 72e0ff3d8044a..5d8a617908b4c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Hover/ILspHoverResultCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/Hover/ILspHoverResultCreationService.cs index 2b797f91c252f..6da46fc0b63fa 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Hover/ILspHoverResultCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Hover/ILspHoverResultCreationService.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.QuickInfo; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/IClientCapabilitiesManager.cs b/src/Features/LanguageServer/Protocol/Handler/IClientCapabilitiesManager.cs index 9b7ce6e7e43aa..5c04bf586c112 100644 --- a/src/Features/LanguageServer/Protocol/Handler/IClientCapabilitiesManager.cs +++ b/src/Features/LanguageServer/Protocol/Handler/IClientCapabilitiesManager.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; #nullable enable diff --git a/src/Features/LanguageServer/Protocol/Handler/IDocumentChangeTracker.cs b/src/Features/LanguageServer/Protocol/Handler/IDocumentChangeTracker.cs index f4a7974435f03..275c707cdb142 100644 --- a/src/Features/LanguageServer/Protocol/Handler/IDocumentChangeTracker.cs +++ b/src/Features/LanguageServer/Protocol/Handler/IDocumentChangeTracker.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.Features.Workspaces; using Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/ILspServiceRequestHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ILspServiceRequestHandler.cs index c4f1788951549..25b5bf0eec1f2 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ILspServiceRequestHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ILspServiceRequestHandler.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintCache.cs b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintCache.cs index aa98addfc4f9b..44c6877e471a6 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintCache.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintCache.cs @@ -4,7 +4,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using static Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint.InlayHintCache; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint; diff --git a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs index bde520de66a74..0914145c19111 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintHandler.cs @@ -15,8 +15,8 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint { diff --git a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueue.cs b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueue.cs index 8e1c0703cf7d4..eef77631f06db 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueue.cs @@ -5,7 +5,7 @@ using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint { diff --git a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveData.cs b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveData.cs index ea549b4facc50..302f8b78e76a8 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveData.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveData.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint; diff --git a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveHandler.cs b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveHandler.cs index cad8944a8c64f..607af391f2339 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintResolveHandler.cs @@ -10,11 +10,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.LanguageServer.Handler.CodeLens; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using Roslyn.Utilities; using StreamJsonRpc; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint { diff --git a/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs index f8c4951ca40c0..3d4b3c31c259f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs @@ -19,7 +19,7 @@ using Microsoft.CodeAnalysis.Simplification; using Microsoft.CodeAnalysis.Snippets; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.LanguageServer.Handler.InlineCompletions.XmlSnippetParser; diff --git a/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs b/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs index 4abc6158ac136..a488aefea3f12 100644 --- a/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs @@ -20,7 +20,7 @@ using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.Completion.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs index 3fb63ca69e04d..ae5410272059c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/PullHandlers/PreviousPullResult.cs b/src/Features/LanguageServer/Protocol/Handler/PullHandlers/PreviousPullResult.cs index 85e419c56b1f6..d164a5b185708 100644 --- a/src/Features/LanguageServer/Protocol/Handler/PullHandlers/PreviousPullResult.cs +++ b/src/Features/LanguageServer/Protocol/Handler/PullHandlers/PreviousPullResult.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs b/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs index 6736cab54c59e..ef7205e352c11 100644 --- a/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/References/FindAllReferencesHandler.cs @@ -14,9 +14,9 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs index 2905d8f9653ed..4217f4b9d99e4 100644 --- a/src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/References/FindImplementationsHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/References/FindUsagesLSPContext.cs b/src/Features/LanguageServer/Protocol/Handler/References/FindUsagesLSPContext.cs index 37b793532c502..c7571c207d347 100644 --- a/src/Features/LanguageServer/Protocol/Handler/References/FindUsagesLSPContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/References/FindUsagesLSPContext.cs @@ -22,11 +22,11 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Core.Imaging; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text.Adornments; +using Roslyn.Core.Imaging; +using Roslyn.LanguageServer.Protocol; +using Roslyn.Text.Adornments; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/References/ILspReferencesResultCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/References/ILspReferencesResultCreationService.cs index 6fadd171ec877..c5595c28e852c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/References/ILspReferencesResultCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/References/ILspReferencesResultCreationService.cs @@ -7,9 +7,9 @@ using System.Composition; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text.Adornments; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using Roslyn.Text.Adornments; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs index 4fa26ac1079d2..00088c8cd4613 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs @@ -11,9 +11,9 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Rename; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index e1a1678d30a49..0974b9c1020c0 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Features.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContextFactory.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContextFactory.cs index 442250e7b2e2d..4a362835f71b5 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContextFactory.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContextFactory.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs index 21a2fc5b28bda..3e15053d47ff7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs @@ -13,9 +13,9 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens { diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs index 8cc34d655ca22..e7a80b9053ef7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs @@ -8,9 +8,9 @@ using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens { diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRefreshQueue.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRefreshQueue.cs index 97aed40551f19..1f75d684b37f5 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRefreshQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRefreshQueue.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Shared.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs index 4265be9758086..2de2c57315e44 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs @@ -6,7 +6,7 @@ using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.Classification; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/TokenModifiers.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/TokenModifiers.cs index 8591b19b6f0d3..c93cf9c6c35ce 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/TokenModifiers.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/TokenModifiers.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens { /// - /// The LSP modifiers from + /// The LSP modifiers from /// Roslyn currently supports. Enum is used to signify the modifier(s) that apply to a given token. /// [Flags] diff --git a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializeHandler.cs index 9f63b4f3a3af8..34643186fb04b 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializeHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializedHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializedHandler.cs index 48f985fa2010d..7f2da6112c874 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializedHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/InitializedHandler.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/LspServiceLifeCycleManager.cs b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/LspServiceLifeCycleManager.cs index d288fde036c4a..ace973dc8d915 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/LspServiceLifeCycleManager.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ServerLifetime/LspServiceLifeCycleManager.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using StreamJsonRpc; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.ServerLifetime; diff --git a/src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs index b49379730822c..058779150580c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs @@ -13,8 +13,8 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.Text.Adornments; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.Text.Adornments; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs index 8dab6ef3d19b7..d3b4eaea093af 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SpellCheck; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SpellCheck diff --git a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/DocumentSpellCheckHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/DocumentSpellCheckHandler.cs index c81eb31a6fddb..33931ed8fdc6d 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/DocumentSpellCheckHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/DocumentSpellCheckHandler.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using System.Threading; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SpellCheck { diff --git a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs index 3766656d8f230..b8ce56eb1cd0b 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs @@ -7,7 +7,7 @@ using System.Threading; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.SpellCheck diff --git a/src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs index ef2640590c741..b22fa4597f54c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Symbols/DocumentSymbolsHandler.cs @@ -13,9 +13,9 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Symbols/ILspSymbolInformationCreationService.cs b/src/Features/LanguageServer/Protocol/Handler/Symbols/ILspSymbolInformationCreationService.cs index 2bf00d1031cbd..ebc72add98679 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Symbols/ILspSymbolInformationCreationService.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Symbols/ILspSymbolInformationCreationService.cs @@ -6,8 +6,8 @@ using System.Composition; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { diff --git a/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbol.cs b/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbol.cs index 32caf9fc4ac34..a508b0251c4b8 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbol.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbol.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Runtime.Serialization; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbolParams.cs b/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbolParams.cs index 1e72b3b7bdae5..ac79269e2d44b 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbolParams.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Symbols/RoslynDocumentSymbolParams.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs index 108cb201a8283..b3b1092b37802 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.NavigateTo; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler diff --git a/src/Features/LanguageServer/Protocol/Handler/WorkspaceCommand/ExecuteWorkspaceCommandHandler.cs b/src/Features/LanguageServer/Protocol/Handler/WorkspaceCommand/ExecuteWorkspaceCommandHandler.cs index 6b72be29076fc..761da70bf4244 100644 --- a/src/Features/LanguageServer/Protocol/Handler/WorkspaceCommand/ExecuteWorkspaceCommandHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/WorkspaceCommand/ExecuteWorkspaceCommandHandler.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.Commands; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Protocol/ICapabilitiesProvider.cs b/src/Features/LanguageServer/Protocol/ICapabilitiesProvider.cs index 317f540badede..2d2f8b29769b2 100644 --- a/src/Features/LanguageServer/Protocol/ICapabilitiesProvider.cs +++ b/src/Features/LanguageServer/Protocol/ICapabilitiesProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { diff --git a/src/Features/LanguageServer/Protocol/IClientCapabilitiesProvider.cs b/src/Features/LanguageServer/Protocol/IClientCapabilitiesProvider.cs index ef6315e3f11ff..d820328d99b67 100644 --- a/src/Features/LanguageServer/Protocol/IClientCapabilitiesProvider.cs +++ b/src/Features/LanguageServer/Protocol/IClientCapabilitiesProvider.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { diff --git a/src/Features/LanguageServer/Protocol/IOnInitialize.cs b/src/Features/LanguageServer/Protocol/IOnInitialize.cs index aca1724edb602..f85b88fe66aea 100644 --- a/src/Features/LanguageServer/Protocol/IOnInitialize.cs +++ b/src/Features/LanguageServer/Protocol/IOnInitialize.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer; diff --git a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj index 5665f82942f57..acb7cfd08d7b4 100644 --- a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj +++ b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj @@ -19,9 +19,6 @@ - - - diff --git a/src/Features/LanguageServer/Protocol/RoslynLanguageServer.cs b/src/Features/LanguageServer/Protocol/RoslynLanguageServer.cs index 7030a7d93a54c..7e1b71b81dfdd 100644 --- a/src/Features/LanguageServer/Protocol/RoslynLanguageServer.cs +++ b/src/Features/LanguageServer/Protocol/RoslynLanguageServer.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.Handler.ServerLifetime; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; using StreamJsonRpc; diff --git a/src/Features/LanguageServer/Protocol/Workspaces/ILspWorkspace.cs b/src/Features/LanguageServer/Protocol/Workspaces/ILspWorkspace.cs index b210250478cb1..519ed552fb875 100644 --- a/src/Features/LanguageServer/Protocol/Workspaces/ILspWorkspace.cs +++ b/src/Features/LanguageServer/Protocol/Workspaces/ILspWorkspace.cs @@ -5,7 +5,7 @@ using Microsoft.CodeAnalysis.Text; using System.Threading; using System.Threading.Tasks; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer; diff --git a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs index 0ee71de05d2fe..a40f57d3ab8fd 100644 --- a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs +++ b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionResolveTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionResolveTests.cs index 86bb6bb14f03e..8434b4ab31f24 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionResolveTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionResolveTests.cs @@ -12,11 +12,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeActions { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs index 30442ca82cd44..19464d962b918 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs @@ -12,12 +12,12 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.AddImport; using Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeActions { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs index 5e40dcef92cd8..61918cc15cb77 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs @@ -14,7 +14,7 @@ using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeActions { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs index b3ac7236d06c0..d1f210e0438b7 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs @@ -8,7 +8,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeLens; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/CSharpCodeLensTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/CSharpCodeLensTests.cs index f57e63f8685bc..014593e00a182 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/CSharpCodeLensTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/CSharpCodeLensTests.cs @@ -11,7 +11,7 @@ using StreamJsonRpc; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeLens; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/VisualBasicCodeLensTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/VisualBasicCodeLensTests.cs index 4eb7333a89b49..e927ef3a51556 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/VisualBasicCodeLensTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/VisualBasicCodeLensTests.cs @@ -8,7 +8,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.CodeLens; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionFeaturesTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionFeaturesTests.cs index 2d0617479b584..83314af24c1b2 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionFeaturesTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionFeaturesTests.cs @@ -18,11 +18,11 @@ using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Completion; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs index a2a7fa539ddf7..a260a03354b3b 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs @@ -15,13 +15,14 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.Text.Adornments; using Newtonsoft.Json; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; +using Microsoft.CodeAnalysis.Extensions; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Completion { @@ -395,7 +396,7 @@ private static VSInternalCompletionItem CreateResolvedCompletionItem( }; } - expectedCompletionItem.Description = description; + expectedCompletionItem.Description = description.ToLSPElement(); return expectedCompletionItem; } diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs index 80b3fa380dde6..82d814a741ebd 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionTests.cs @@ -12,11 +12,11 @@ using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Completion { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs b/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs index 5288270ce0394..c93a745b5f903 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.LanguageServer.Handler.Configuration; using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json.Linq; using Roslyn.Test.Utilities; using Roslyn.Utilities; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs index 72f26342b4d8b..c9e917ded7591 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToDefinitionTests.cs @@ -12,7 +12,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Definitions { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs index 7f72c6e6a731c..a4a1aa043ee23 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Definitions/GoToTypeDefinitionTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Definitions { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AbstractPullDiagnosticTestsBase.cs b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AbstractPullDiagnosticTestsBase.cs index d848b77dd429c..f3189764c616f 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AbstractPullDiagnosticTestsBase.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AbstractPullDiagnosticTestsBase.cs @@ -20,12 +20,12 @@ using Microsoft.CodeAnalysis.TaskList; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs index c86b6e2847154..f1402110cb780 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs @@ -15,7 +15,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics; public class AdditionalFileDiagnosticsTests : AbstractPullDiagnosticTestsBase diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs index 4554f22b7ae06..f829a9ad36b0e 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs @@ -15,13 +15,13 @@ using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.TaskList; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Test.Utilities.TestGenerators; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs index 90479560f7870..d25ec24fde0d2 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs @@ -14,7 +14,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics; public class WorkspaceProjectDiagnosticsTests : AbstractPullDiagnosticTestsBase diff --git a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs index db82b356290d7..f16259e730118 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; using Xunit; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.WithFindAllReferences.cs b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.WithFindAllReferences.cs index 7ad6732e9ac9c..7f7c16bc01079 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.WithFindAllReferences.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.WithFindAllReferences.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServer.UnitTests.References; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.DocumentChanges diff --git a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.cs index ddac46715962a..f950884553731 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.cs @@ -9,11 +9,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.DocumentChanges { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs index b7fdb0d8bedd8..359357d356b7f 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs @@ -11,7 +11,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.FoldingRanges { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs index 4be504bd97971..4da943682de44 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentOnTypeTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Formatting { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs index a3a09526bdb9f..70acb3ab8995a 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentRangeTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Formatting { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs index b9dafa1334dc5..bc85cdaf0a894 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Formatting/FormatDocumentTests.cs @@ -11,7 +11,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Formatting { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs index 2a74031ff7064..ed6865185b319 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Highlights/DocumentHighlightTests.cs @@ -11,7 +11,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Highlights { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs index 8c47a4dcb14cd..4e44b92dd39dd 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs @@ -12,7 +12,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Hover { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs index a8a7b3ca17926..84a63a9e872e2 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.InlayHint; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/CSharpInlayHintTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/CSharpInlayHintTests.cs index a338d1d753c80..d4d0801f11fcc 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/CSharpInlayHintTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/CSharpInlayHintTests.cs @@ -9,7 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.CodeAnalysis.LanguageServer.Handler.InlayHint; using Microsoft.CodeAnalysis.Text; using Newtonsoft.Json; @@ -17,7 +17,7 @@ using StreamJsonRpc; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.InlayHint { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/VisualBasicInlayHintTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/VisualBasicInlayHintTests.cs index 8c813143bf2e0..e4093edc0a2c9 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/VisualBasicInlayHintTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/VisualBasicInlayHintTests.cs @@ -8,10 +8,10 @@ using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.InlayHint { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/InlineCompletionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/InlineCompletionsTests.cs index 1f1ef1d0f164c..cf44a18869abb 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/InlineCompletionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/InlineCompletionsTests.cs @@ -11,7 +11,7 @@ using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs index 8b9ea8358c053..78f90f89a3578 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/LanguageServerTargetTests.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using StreamJsonRpc; using Xunit; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Miscellaneous/LspMiscellaneousFilesWorkspaceTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Miscellaneous/LspMiscellaneousFilesWorkspaceTests.cs index b7e09a5a65786..7fe68e757da2f 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Miscellaneous/LspMiscellaneousFilesWorkspaceTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Miscellaneous/LspMiscellaneousFilesWorkspaceTests.cs @@ -13,7 +13,7 @@ using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Miscellaneous; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs index 028f9bfacd476..ac32257a36b88 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs @@ -6,12 +6,12 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.OnAutoInsert { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingMutatingRequestHandler.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingMutatingRequestHandler.cs index 1968051ca3771..dd6253890813c 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingMutatingRequestHandler.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingMutatingRequestHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingRequestHandler.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingRequestHandler.cs index 3ae1219f938d7..8841d8d0c721d 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingRequestHandler.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/FailingRequestHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/LongRunningNonMutatingRequestHandler.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/LongRunningNonMutatingRequestHandler.cs index 0ef3ce29f1c11..7efbb2c1de428 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/LongRunningNonMutatingRequestHandler.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/LongRunningNonMutatingRequestHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit.Sdk; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/MutatingRequestHandler.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/MutatingRequestHandler.cs index 1492eddbdd29c..4d1e9c523b4f2 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/MutatingRequestHandler.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/MutatingRequestHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonLSPSolutionRequestHandlerProvider.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonLSPSolutionRequestHandlerProvider.cs index 91ce841d967fd..71c430fce1a42 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonLSPSolutionRequestHandlerProvider.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonLSPSolutionRequestHandlerProvider.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonMutatingRequestHandler.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonMutatingRequestHandler.cs index 90167e66d8b6c..4a8d27209653e 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonMutatingRequestHandler.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/NonMutatingRequestHandler.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/RequestOrderingTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/RequestOrderingTests.cs index 8a3e3b82ac7d5..f9bf10d53f502 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Ordering/RequestOrderingTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Ordering/RequestOrderingTests.cs @@ -8,12 +8,12 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.RequestOrdering { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/ProjectContext/GetTextDocumentWithContextHandlerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/ProjectContext/GetTextDocumentWithContextHandlerTests.cs index 445bd2fd2a3ac..44befe94053bb 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/ProjectContext/GetTextDocumentWithContextHandlerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/ProjectContext/GetTextDocumentWithContextHandlerTests.cs @@ -9,7 +9,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.ProjectContext { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs index 7a6807d90eb3a..655dbce500a49 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs @@ -5,9 +5,9 @@ using System; using System.Linq; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; +using Range = Roslyn.LanguageServer.Protocol.Range; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs index 0f94a621190c9..145c8a4244930 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs @@ -13,7 +13,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.References; public class FindAllReferencesHandlerFeaturesTests : AbstractLanguageServerProtocolTests diff --git a/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs index de2ac649cabd8..5eb317a9aa0ae 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs @@ -17,7 +17,7 @@ using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.References { @@ -314,7 +314,8 @@ private static void AssertValidDefinitionProperties(LSP.VSInternalReferenceItem[ var definitionId = definition.DefinitionId; Assert.NotNull(definition.DefinitionText); - Assert.Equal(definitionGlyph.GetImageId(), definition.DefinitionIcon.ImageId); + Assert.Equal(definitionGlyph.GetImageId().Guid, definition.DefinitionIcon.ImageId.Guid); + Assert.Equal(definitionGlyph.GetImageId().Id, definition.DefinitionIcon.ImageId.Id); for (var i = 0; i < referenceItems.Length; i++) { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs index 7ab37e326e8d6..983104d7f9d9b 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/References/FindImplementationsTests.cs @@ -12,7 +12,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.References { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs index d378b12757070..f75360ae8c444 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Rename/RenameTests.cs @@ -9,11 +9,11 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Rename { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/AbstractSemanticTokensTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/AbstractSemanticTokensTests.cs index 007afa5b15ee1..509aa831f40da 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/AbstractSemanticTokensTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/AbstractSemanticTokensTests.cs @@ -12,12 +12,12 @@ using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs index ad3bd913945b7..db134ecf48f2f 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs @@ -12,11 +12,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Classification; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs index 669f7bae7074b..add3de22df18e 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.SignatureHelp { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/SpellCheck/SpellCheckTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/SpellCheck/SpellCheckTests.cs index edea38a93f87e..775d6669a6b43 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/SpellCheck/SpellCheckTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/SpellCheck/SpellCheckTests.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs index 1076752642490..8a610bea92f83 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Symbols/DocumentSymbolsTests.cs @@ -11,7 +11,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Symbols { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs index c2ae1c6b59485..a373d4e4f80e6 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Symbols/WorkspaceSymbolsTests.cs @@ -12,7 +12,7 @@ using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Symbols { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/UriTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/UriTests.cs index e800811f074fb..121965996963e 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/UriTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/UriTests.cs @@ -11,7 +11,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests; public class UriTests : AbstractLanguageServerProtocolTests diff --git a/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs index 1f0eb983e8a57..e4ae5488debb4 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs @@ -18,7 +18,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Nerdbank.Streams; using Roslyn.Test.Utilities; using StreamJsonRpc; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/ValidateBreakableRange/ValidateBreakableRangeTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/ValidateBreakableRange/ValidateBreakableRangeTests.cs index 8b829521dc51f..b178d7a9a36fe 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/ValidateBreakableRange/ValidateBreakableRangeTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/ValidateBreakableRange/ValidateBreakableRangeTests.cs @@ -10,7 +10,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.ValidateBreakableRange { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs index 52f90730040af..b0eb4a9fa094f 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs @@ -15,7 +15,7 @@ using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Workspaces; diff --git a/src/Features/Lsif/Generator/Generator.cs b/src/Features/Lsif/Generator/Generator.cs index 66e943f1655ef..04ac8c43ab997 100644 --- a/src/Features/Lsif/Generator/Generator.cs +++ b/src/Features/Lsif/Generator/Generator.cs @@ -17,10 +17,10 @@ using Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using LspProtocol = Microsoft.VisualStudio.LanguageServer.Protocol; -using Methods = Microsoft.VisualStudio.LanguageServer.Protocol.Methods; +using LspProtocol = Roslyn.LanguageServer.Protocol; +using Methods = Roslyn.LanguageServer.Protocol.Methods; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator { diff --git a/src/Features/Lsif/Generator/Graph/FoldingRangeResult.cs b/src/Features/Lsif/Generator/Graph/FoldingRangeResult.cs index cde2cdaca3597..de9c8ffb8558b 100644 --- a/src/Features/Lsif/Generator/Graph/FoldingRangeResult.cs +++ b/src/Features/Lsif/Generator/Graph/FoldingRangeResult.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph diff --git a/src/Features/Lsif/Generator/Graph/HoverResult.cs b/src/Features/Lsif/Generator/Graph/HoverResult.cs index 0a054dfceed7e..2dbd5246c5b2b 100644 --- a/src/Features/Lsif/Generator/Graph/HoverResult.cs +++ b/src/Features/Lsif/Generator/Graph/HoverResult.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph diff --git a/src/Features/Lsif/Generator/Graph/Range.cs b/src/Features/Lsif/Generator/Graph/Range.cs index a6b752616f7f4..9a73deaf84e73 100644 --- a/src/Features/Lsif/Generator/Graph/Range.cs +++ b/src/Features/Lsif/Generator/Graph/Range.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph { diff --git a/src/Features/Lsif/Generator/Graph/SemanticTokensResult.cs b/src/Features/Lsif/Generator/Graph/SemanticTokensResult.cs index bc732d25edf54..7ff7ffdb6e3ff 100644 --- a/src/Features/Lsif/Generator/Graph/SemanticTokensResult.cs +++ b/src/Features/Lsif/Generator/Graph/SemanticTokensResult.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph diff --git a/src/Features/Lsif/Generator/ResultSetTracking/IResultSetTrackerExtensions.cs b/src/Features/Lsif/Generator/ResultSetTracking/IResultSetTrackerExtensions.cs index f2400eb5a8739..159848e0f3c35 100644 --- a/src/Features/Lsif/Generator/ResultSetTracking/IResultSetTrackerExtensions.cs +++ b/src/Features/Lsif/Generator/ResultSetTracking/IResultSetTrackerExtensions.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.ResultSetTracking { diff --git a/src/Features/Lsif/GeneratorTest/FoldingRangeTests.vb b/src/Features/Lsif/GeneratorTest/FoldingRangeTests.vb index 42393c23a7363..14100027ef4c8 100644 --- a/src/Features/Lsif/GeneratorTest/FoldingRangeTests.vb +++ b/src/Features/Lsif/GeneratorTest/FoldingRangeTests.vb @@ -4,7 +4,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Test.Utilities -Imports Microsoft.VisualStudio.LanguageServer.Protocol +Imports Roslyn.LanguageServer.Protocol Imports Roslyn.Test.Utilities Imports Roslyn.Utilities diff --git a/src/Features/Lsif/GeneratorTest/HoverTests.vb b/src/Features/Lsif/GeneratorTest/HoverTests.vb index 0704278379b28..6b6f527a742a0 100644 --- a/src/Features/Lsif/GeneratorTest/HoverTests.vb +++ b/src/Features/Lsif/GeneratorTest/HoverTests.vb @@ -4,7 +4,7 @@ Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Test.Utilities -Imports Microsoft.VisualStudio.LanguageServer.Protocol +Imports Roslyn.LanguageServer.Protocol Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests diff --git a/src/Features/Lsif/GeneratorTest/RangeResultSetTests.vb b/src/Features/Lsif/GeneratorTest/RangeResultSetTests.vb index c41fb236b127d..49cb55c5f5bf2 100644 --- a/src/Features/Lsif/GeneratorTest/RangeResultSetTests.vb +++ b/src/Features/Lsif/GeneratorTest/RangeResultSetTests.vb @@ -2,9 +2,8 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. -Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Test.Utilities -Imports Microsoft.VisualStudio.LanguageServer.Protocol +Imports Roslyn.LanguageServer.Protocol Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests diff --git a/src/Features/Lsif/GeneratorTest/Utilities/TestLsifOutput.vb b/src/Features/Lsif/GeneratorTest/Utilities/TestLsifOutput.vb index 9605606563494..2efe95f5f456a 100644 --- a/src/Features/Lsif/GeneratorTest/Utilities/TestLsifOutput.vb +++ b/src/Features/Lsif/GeneratorTest/Utilities/TestLsifOutput.vb @@ -3,15 +3,15 @@ ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable +Imports System.IO +Imports System.Threading Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph Imports Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing +Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.Text -Imports LSP = Microsoft.VisualStudio.LanguageServer.Protocol Imports Roslyn.Utilities -Imports Microsoft.CodeAnalysis.Test.Utilities -Imports System.Threading -Imports System.IO +Imports LSP = Roslyn.LanguageServer.Protocol Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests.Utilities Friend Class TestLsifOutput diff --git a/src/Tools/ExternalAccess/CompilerDeveloperSDK/Extensions/ProtocolConversions.cs b/src/Tools/ExternalAccess/CompilerDeveloperSDK/Extensions/ProtocolConversions.cs index a6816ca52bd1a..752672d37be51 100644 --- a/src/Tools/ExternalAccess/CompilerDeveloperSDK/Extensions/ProtocolConversions.cs +++ b/src/Tools/ExternalAccess/CompilerDeveloperSDK/Extensions/ProtocolConversions.cs @@ -1,9 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Text; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; using PC = Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions; namespace Microsoft.CodeAnalysis.ExternalAccess.CompilerDeveloperSdk; diff --git a/src/Tools/ExternalAccess/CompilerDeveloperSDK/Handler/AbstractCompilerDeveloperSdkLspServiceDocumentRequestHandler.cs b/src/Tools/ExternalAccess/CompilerDeveloperSDK/Handler/AbstractCompilerDeveloperSdkLspServiceDocumentRequestHandler.cs index f7d369881fc2f..dfe7937504bcd 100644 --- a/src/Tools/ExternalAccess/CompilerDeveloperSDK/Handler/AbstractCompilerDeveloperSdkLspServiceDocumentRequestHandler.cs +++ b/src/Tools/ExternalAccess/CompilerDeveloperSDK/Handler/AbstractCompilerDeveloperSdkLspServiceDocumentRequestHandler.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.CompilerDeveloperSdk; diff --git a/src/Tools/ExternalAccess/FSharp/VS/IFSharpWorkspaceProjectContextFactory.cs b/src/Tools/ExternalAccess/FSharp/VS/IFSharpWorkspaceProjectContextFactory.cs index f7042f933c403..c55fcf2bd1a8d 100644 --- a/src/Tools/ExternalAccess/FSharp/VS/IFSharpWorkspaceProjectContextFactory.cs +++ b/src/Tools/ExternalAccess/FSharp/VS/IFSharpWorkspaceProjectContextFactory.cs @@ -7,12 +7,9 @@ using System.Collections.Immutable; using System.Composition; using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.ProjectSystem; using Microsoft.VisualStudio.Shell.Interop; diff --git a/src/Tools/ExternalAccess/Razor/IRazorCapabilitiesProvider.cs b/src/Tools/ExternalAccess/Razor/IRazorCapabilitiesProvider.cs index 81463e63d70aa..ac26de8cbd80c 100644 --- a/src/Tools/ExternalAccess/Razor/IRazorCapabilitiesProvider.cs +++ b/src/Tools/ExternalAccess/Razor/IRazorCapabilitiesProvider.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { diff --git a/src/Tools/ExternalAccess/Razor/RazorLanguageServerFactoryWrapper.cs b/src/Tools/ExternalAccess/Razor/RazorLanguageServerFactoryWrapper.cs index 0b8878091b24e..8ca8896a66974 100644 --- a/src/Tools/ExternalAccess/Razor/RazorLanguageServerFactoryWrapper.cs +++ b/src/Tools/ExternalAccess/Razor/RazorLanguageServerFactoryWrapper.cs @@ -5,17 +5,13 @@ using System; using System.Collections.Generic; using System.Composition; -using System.Threading.Tasks; -using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Newtonsoft.Json.Linq; -using StreamJsonRpc; using Microsoft.VisualStudio.Composition; using Newtonsoft.Json; +using Roslyn.LanguageServer.Protocol; +using StreamJsonRpc; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { diff --git a/src/Tools/ExternalAccess/Razor/RazorSemanticTokensAccessor.cs b/src/Tools/ExternalAccess/Razor/RazorSemanticTokensAccessor.cs index 500251f41e92e..db659296d92f7 100644 --- a/src/Tools/ExternalAccess/Razor/RazorSemanticTokensAccessor.cs +++ b/src/Tools/ExternalAccess/Razor/RazorSemanticTokensAccessor.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor { diff --git a/src/Tools/IdeBenchmarks/Lsp/LspCompletionBenchmarks.cs b/src/Tools/IdeBenchmarks/Lsp/LspCompletionBenchmarks.cs index c565e1a337d60..3656fde72d43d 100644 --- a/src/Tools/IdeBenchmarks/Lsp/LspCompletionBenchmarks.cs +++ b/src/Tools/IdeBenchmarks/Lsp/LspCompletionBenchmarks.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace IdeBenchmarks.Lsp { diff --git a/src/Tools/IdeBenchmarks/Lsp/LspCompletionSerializationBenchmarks.cs b/src/Tools/IdeBenchmarks/Lsp/LspCompletionSerializationBenchmarks.cs index d171ac617d04b..110470f38dfdb 100644 --- a/src/Tools/IdeBenchmarks/Lsp/LspCompletionSerializationBenchmarks.cs +++ b/src/Tools/IdeBenchmarks/Lsp/LspCompletionSerializationBenchmarks.cs @@ -4,21 +4,18 @@ using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; +using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.UnitTests.Completion; using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Test.Utilities; -using Newtonsoft.Json.Converters; using Newtonsoft.Json; using Roslyn.Test.Utilities; using Xunit; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox; -using static Roslyn.Test.Utilities.AbstractLanguageServerProtocolTests; -using System.Threading; -using Microsoft.CodeAnalysis.LanguageServer; -using Microsoft.CodeAnalysis.PooledObjects; +using LSP = Roslyn.LanguageServer.Protocol; namespace IdeBenchmarks.Lsp { diff --git a/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTestsBase.cs b/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTestsBase.cs index d78efbc4985d4..eeca98fa5fac1 100644 --- a/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTestsBase.cs +++ b/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTestsBase.cs @@ -19,16 +19,14 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Threading; using Moq; using Newtonsoft.Json.Linq; -using Roslyn.Test.Utilities; using Xunit.Abstractions; using static Roslyn.Test.Utilities.AbstractLanguageServerProtocolTests; using IAsyncDisposable = System.IAsyncDisposable; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Roslyn.VisualStudio.CSharp.UnitTests.DocumentOutline { diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.DocumentOutlineViewState.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.DocumentOutlineViewState.cs index 0ef4067c52feb..9bcb1fec8243a 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.DocumentOutlineViewState.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.DocumentOutlineViewState.cs @@ -4,7 +4,6 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.Shared.Collections; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text; namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.IntervalIntrospector.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.IntervalIntrospector.cs index 0fd9ee06eedde..fa25861453f12 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.IntervalIntrospector.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.IntervalIntrospector.cs @@ -3,8 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Shared.Collections; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text; namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline { diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.cs index dd966a0d3efab..c80638fc364c1 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.cs @@ -3,39 +3,30 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel; using System.Diagnostics; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Collections; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.SemanticModelReuse; using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; -using Microsoft.Internal.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Utilities; using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Threading; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using VsWebSite; namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline { - using LspDocumentSymbol = DocumentSymbol; - /// /// Responsible for updating data related to Document outline. It is expected that all public methods on this type /// do not need to be on the UI thread. Two properties: and are diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs index 511f075fa8406..c21b9f9d4f9fb 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs @@ -13,15 +13,15 @@ using Microsoft.CodeAnalysis.PatternMatching; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text; using Newtonsoft.Json.Linq; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline { using LspDocumentSymbol = DocumentSymbol; - using Range = LanguageServer.Protocol.Range; + using Range = Roslyn.LanguageServer.Protocol.Range; internal sealed partial class DocumentOutlineViewModel { diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolData.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolData.cs index d70e987de98a8..33eaeb495a510 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolData.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolData.cs @@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline { - using SymbolKind = LanguageServer.Protocol.SymbolKind; + using SymbolKind = Roslyn.LanguageServer.Protocol.SymbolKind; /// /// Represents the immutable symbol returned from the LSP request to get document symbols, but mapped into diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolDataViewModel.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolDataViewModel.cs index ae6096a7da7b6..8da555fe33ecc 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolDataViewModel.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentSymbolDataViewModel.cs @@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline { - using SymbolKind = LanguageServer.Protocol.SymbolKind; - /// /// A ViewModel over . The only items that are mutable on this type are and . It is expected that these can be modified from any thread with diff --git a/src/VisualStudio/Core/Def/DocumentOutline/SortOption.cs b/src/VisualStudio/Core/Def/DocumentOutline/SortOption.cs index 44d549dce4c12..81bd336e4af2e 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/SortOption.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/SortOption.cs @@ -18,7 +18,7 @@ internal enum SortOption /// Location, /// - /// Sort by document symbol . + /// Sort by document symbol . /// /// /// At the moment, we order the symbols by the SymbolKind enum values. If this ordering turns out to be diff --git a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs index 1ab90b7d80964..9b2f4d5f7067a 100644 --- a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs +++ b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; -using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.Options; @@ -21,7 +20,6 @@ using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Composition; -using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Projects; using Microsoft.VisualStudio.LiveShare; @@ -31,7 +29,7 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Workspace.VSIntegration.Contracts; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; using Task = System.Threading.Tasks.Task; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client diff --git a/src/VisualStudio/LiveShare/Impl/CustomProtocol/LspRequestExtensions.cs b/src/VisualStudio/LiveShare/Impl/CustomProtocol/LspRequestExtensions.cs index 306e6f3702157..0ea73a232dda3 100644 --- a/src/VisualStudio/LiveShare/Impl/CustomProtocol/LspRequestExtensions.cs +++ b/src/VisualStudio/LiveShare/Impl/CustomProtocol/LspRequestExtensions.cs @@ -4,9 +4,8 @@ #nullable disable -using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; using LS = Microsoft.VisualStudio.LiveShare.LanguageServices; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Protocol { @@ -17,6 +16,5 @@ public static LS.LspRequest ToLSRequest(this LSP.LspReques public static LSP.ClientCapabilities GetClientCapabilities(this LS.RequestContext requestContext) => requestContext.ClientCapabilities?.ToObject() ?? new LSP.VSInternalClientCapabilities(); - } } diff --git a/src/VisualStudio/Setup.Dependencies/Roslyn.VisualStudio.Setup.Dependencies.csproj b/src/VisualStudio/Setup.Dependencies/Roslyn.VisualStudio.Setup.Dependencies.csproj index 45475844c1cc8..3d4b1dd0d9019 100644 --- a/src/VisualStudio/Setup.Dependencies/Roslyn.VisualStudio.Setup.Dependencies.csproj +++ b/src/VisualStudio/Setup.Dependencies/Roslyn.VisualStudio.Setup.Dependencies.csproj @@ -87,9 +87,5 @@ - - - - \ No newline at end of file diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlCapabilities.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlCapabilities.cs index b03d34482da22..154658039405f 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlCapabilities.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlCapabilities.cs @@ -4,7 +4,7 @@ using System.Linq; using Microsoft.CodeAnalysis.Editor.Xaml; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler; using RoslynCompletion = Microsoft.CodeAnalysis.Completion; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs index 26dd5bfee62da..a0bb55e42ff8f 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs @@ -19,7 +19,7 @@ using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; using Microsoft.VisualStudio.LanguageServices.Xaml.Telemetry; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs index faf8a225a0b53..73c76312397f4 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServer.Client; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageClient; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; using Microsoft.VisualStudio.Utilities; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/CodeActions/CodeActionsHandlerProvider.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/CodeActions/CodeActionsHandlerProvider.cs index 4c041562a38be..c74f3a18c0bd2 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/CodeActions/CodeActionsHandlerProvider.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/CodeActions/CodeActionsHandlerProvider.cs @@ -14,7 +14,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; using Microsoft.CodeAnalysis.LanguageServer.Handler.Commands; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Commands/CreateEventCommandHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Commands/CreateEventCommandHandler.cs index 5115878bf4107..570bcc06d78bb 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Commands/CreateEventCommandHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Commands/CreateEventCommandHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.Handler.Commands; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Commands; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Completion; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs index 16dcdbf3d379a..ee946d5f596f9 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs @@ -16,8 +16,9 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Completion; +using Microsoft.CodeAnalysis.Extensions; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { @@ -90,8 +91,8 @@ private static CompletionItem CreateCompletionItem(XamlCompletionItem xamlComple SortText = xamlCompletion.SortText, FilterText = xamlCompletion.FilterText, Kind = GetItemKind(xamlCompletion.Kind), - Description = xamlCompletion.Description, - Icon = xamlCompletion.Icon, + Description = xamlCompletion.Description.ToLSPElement(), + Icon = xamlCompletion.Icon.ToLSPImageElement(), InsertTextFormat = xamlCompletion.IsSnippet ? InsertTextFormat.Snippet : InsertTextFormat.Plaintext, Data = new CompletionResolveData { ProjectGuid = documentId.ProjectId.Id, DocumentGuid = documentId.Id, Position = position, DisplayText = xamlCompletion.DisplayText } }; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveData.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveData.cs index 28a67913f142f..663b1c9562dff 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveData.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveData.cs @@ -5,7 +5,7 @@ #nullable disable using System; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs index 15b83489ef506..3b1b10ba43021 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs @@ -8,19 +8,18 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Editor.Xaml; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.CodeAnalysis.LanguageService; +using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Completion; using Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer.Extensions; -using Microsoft.VisualStudio.Text.Adornments; using Newtonsoft.Json.Linq; +using Roslyn.LanguageServer.Protocol; +using Roslyn.Text.Adornments; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Definitions/GoToDefinitionHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Definitions/GoToDefinitionHandler.cs index c2fab79dbeec5..89182e8c216d9 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Definitions/GoToDefinitionHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Definitions/GoToDefinitionHandler.cs @@ -19,11 +19,11 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Definitions; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer.Handler.Definitions { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index f54086864e54c..de2438497908e 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -15,10 +15,10 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Diagnostics; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer.Handler.Diagnostics { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs index ff110d15f05e4..28d0218dcbe07 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Diagnostics; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs index 65da76a99fc8c..96ebf40f389ba 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Diagnostics; using Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer.Extensions; using Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/FoldingRanges/FoldingRangesHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/FoldingRanges/FoldingRangesHandler.cs index b5ade7d53dea6..559f295df4012 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/FoldingRanges/FoldingRangesHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/FoldingRanges/FoldingRangesHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Structure; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs index 45325683e2798..a48c4037b998a 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs @@ -10,9 +10,9 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Formatting; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentHandler.cs index 4e7738babafad..95b779c218cd4 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentHandler.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Editor.Xaml; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs index 27072826f883c..feb2ef0feb285 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs @@ -14,7 +14,7 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.Formatting; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentRangeHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentRangeHandler.cs index 758db2c77e47c..1b857b2c11e3f 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentRangeHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentRangeHandler.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Editor.Xaml; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer.Handler { diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs index 12d1e3a3d34a7..c598896a9291a 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.QuickInfo; using Microsoft.VisualStudio.LanguageServices.Xaml.Implementation.LanguageServer.Extensions; using Microsoft.VisualStudio.Text.Adornments; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnAutoInsert/OnAutoInsertHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnAutoInsert/OnAutoInsertHandler.cs index 44692ed0a3a85..f24b2a2d81c33 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnAutoInsert/OnAutoInsertHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnAutoInsert/OnAutoInsertHandler.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.AutoInsert; using Roslyn.Utilities; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnTypeRename/OnTypeRenameHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnTypeRename/OnTypeRenameHandler.cs index e794398acf0b7..9678f9a2a12ed 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnTypeRename/OnTypeRenameHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/OnTypeRename/OnTypeRenameHandler.cs @@ -11,7 +11,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Features.TypeRename; using Roslyn.Utilities; diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestExecutionQueue.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestExecutionQueue.cs index e040d8f6aca8c..7aed553e37112 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestExecutionQueue.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestExecutionQueue.cs @@ -14,7 +14,7 @@ using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.Xaml.Telemetry; namespace Microsoft.VisualStudio.LanguageServices.Xaml.LanguageServer From 7592fef9223a16c852cd1f8b552e0f52944fbad7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 12 Jul 2023 09:00:47 -0700 Subject: [PATCH 02/23] lint --- .../Protocol/CompletionListItemDefaults.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs index 8d450048aa1d7..c5e247a57319e 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/CompletionListItemDefaults.cs @@ -5,7 +5,6 @@ namespace Roslyn.LanguageServer.Protocol { using System.Runtime.Serialization; - using Newtonsoft.Json; /// @@ -46,7 +45,7 @@ public InsertTextFormat? InsertTextFormat get; set; } - + /// /// Gets or sets the default . /// From f74a4bca0a5dbf7d26e73c75b356372f1e21a70d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 12 Jul 2023 09:01:10 -0700 Subject: [PATCH 03/23] Lint --- .../Protocol/InlayHint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs index 2bb86ffadfe71..c11ab42aa783b 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Protocol/InlayHint.cs @@ -50,7 +50,7 @@ public InlayHintKind? Kind /// Gets or sets the TextEdits associated with this inlay hint. /// [DataMember(Name = "textEdits")] - [JsonProperty (NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public TextEdit[]? TextEdits { get; From 448194d62f61d7d6b5b6e288bccf084042b91d88 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 12 Jul 2023 09:14:49 -0700 Subject: [PATCH 04/23] Update --- ...osoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj index 751821d084341..016c731740697 100644 --- a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj +++ b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj @@ -54,6 +54,9 @@ + + + 16.10.0 @@ -169,9 +168,6 @@ 15.8.27812-alpha $(VisualStudioEditorPackagesVersion) $(VisualStudioEditorPackagesVersion) - $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion) - $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion) - $(MicrosoftVisualStudioLanguageServerProtocolPackagesVersion) $(MicrosoftVisualStudioLanguageServerClientPackagesVersion) $(MicrosoftVisualStudioLanguageServerClientPackagesVersion) $(VisualStudioEditorPackagesVersion) diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs index 56b21809f6b2b..c7b1b6b940865 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LspFileChangeWatcherTests.cs @@ -6,12 +6,12 @@ using Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using StreamJsonRpc; using Xunit.Abstractions; -using FileSystemWatcher = Microsoft.VisualStudio.LanguageServer.Protocol.FileSystemWatcher; +using FileSystemWatcher = Roslyn.LanguageServer.Protocol.FileSystemWatcher; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs index 68de69c6802ca..e0b3bc0a79f96 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/ServerInitializationTests.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests; @@ -37,7 +37,7 @@ public async Task TestServerHandlesTextSyncRequestsAsync() [ new TextDocumentContentChangeEvent { - Range = new VisualStudio.LanguageServer.Protocol.Range { Start = new Position(0, 0), End = new Position(0, 0) }, + Range = new Roslyn.LanguageServer.Protocol.Range { Start = new Position(0, 0), End = new Position(0, 0) }, Text = "Console." } ] diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs index 0d0e52c99dc8e..c6b3b7ae1d67b 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerHostTests.cs @@ -5,9 +5,8 @@ using Microsoft.CodeAnalysis.LanguageServer.LanguageServer; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Composition; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Nerdbank.Streams; -using Roslyn.Utilities; +using Roslyn.LanguageServer.Protocol; using StreamJsonRpc; using Xunit.Abstractions; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs index 7635ee9c55452..89a3613e08fe5 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspContractTypes.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using Newtonsoft.Json; -namespace Microsoft.VisualStudio.LanguageServer.Protocol; +namespace Roslyn.LanguageServer.Protocol; [DataContract] internal class DidChangeWatchedFilesRegistrationOptions diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs index 04faf2d4433a3..da93cef394d36 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspDidChangeWatchedFilesHandler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -6,7 +6,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching; @@ -30,4 +30,4 @@ Task INotificationHandler.HandleNot } public event EventHandler? NotificationRaised; -} \ No newline at end of file +} diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs index 33e4e58dad4b5..a6e3d506bf119 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs @@ -2,15 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.LanguageServer.LanguageServer; using Microsoft.CodeAnalysis.ProjectSystem; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using System.Collections.Immutable; +using Roslyn.LanguageServer.Protocol; using Roslyn.Utilities; -using FileSystemWatcher = Microsoft.VisualStudio.LanguageServer.Protocol.FileSystemWatcher; -using Microsoft.CodeAnalysis.LanguageServer.Handler; using StreamJsonRpc; +using FileSystemWatcher = Roslyn.LanguageServer.Protocol.FileSystemWatcher; namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs index afc58b591db78..2a53378fd4e3e 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.MSBuild; using Microsoft.CodeAnalysis.MSBuild.Logging; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.ProjectSystem; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Workspaces.ProjectSystem; @@ -22,7 +21,7 @@ using Microsoft.VisualStudio.Composition; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs index 9a1526d3d49fe..4d4268f4a1db0 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerWorkspace.cs @@ -2,11 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Immutable; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Workspaces.ProjectSystem; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs index a286f9bdf9f4a..1d3b795be6ba1 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/DebugConfiguration/WorkspaceDebugConfigurationParams.cs @@ -2,10 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Runtime.Serialization; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DebugConfiguration; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs index 8be4c80ef0e46..44bf12762fc65 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServer/Handler/Restore/RestoreParams.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using System.Runtime.Serialization; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Newtonsoft.Json; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs index 6605b60f3332f..b7779d844ae46 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Composition; using Microsoft.CodeAnalysis.LanguageServer.LanguageServer; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using StreamJsonRpc; +using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Logging; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs index 9690e247e0a8a..b9b7ea2f7a8b8 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ShowToastNotification.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using Microsoft.CodeAnalysis.LanguageServer.LanguageServer; using Roslyn.Utilities; -using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; +using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer; diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj index 81b6dfd9fb064..3c676b9cefc3f 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj @@ -77,7 +77,6 @@ - diff --git a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj index 016c731740697..751821d084341 100644 --- a/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj +++ b/src/VisualStudio/CSharp/Test/Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj @@ -54,9 +54,6 @@ - - - From 0c984c09b83eb54fbd741e413f9d7e96ad3fc91e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 15 Dec 2023 12:51:47 -0800 Subject: [PATCH 23/23] Fix --- .../HandlerProvider.cs | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs index 9d79e5d74451c..5f3a335083a4f 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/HandlerProvider.cs @@ -134,20 +134,50 @@ static string GetRequestHandlerMethod(Type handlerType, Type? requestType, Type static LanguageServerEndpointAttribute? GetMethodAttributeFromHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType) { - var methodInfo = (requestType != null, responseType != null) switch + const string handleRequestName = nameof(IRequestHandler.HandleRequestAsync); + const string handleNotificationName = nameof(INotificationHandler.HandleNotificationAsync); + + foreach (var methodInfo in handlerType.GetRuntimeMethods()) { - (true, true) => handlerType.GetMethod(nameof(IRequestHandler.HandleRequestAsync), new Type[] { requestType!, contextType, typeof(CancellationToken) }), - (false, true) => handlerType.GetMethod(nameof(IRequestHandler.HandleRequestAsync), new Type[] { contextType, typeof(CancellationToken) }), - (true, false) => handlerType.GetMethod(nameof(INotificationHandler.HandleNotificationAsync), new Type[] { requestType!, contextType, typeof(CancellationToken) }), - (false, false) => handlerType.GetMethod(nameof(INotificationHandler.HandleNotificationAsync), new Type[] { contextType, typeof(CancellationToken) }) - }; + if (MethodInfoMatches(methodInfo)) + return methodInfo.GetCustomAttribute(); + } + + throw new InvalidOperationException("Somehow we are missing the method for our registered handler"); - if (methodInfo is null) + bool MethodInfoMatches(MethodInfo methodInfo) { - throw new InvalidOperationException("Somehow we are missing the method for our registered handler"); + switch (requestType != null, responseType != null) + { + case (true, true): + return (methodInfo.Name == handleRequestName || methodInfo.Name.EndsWith("." + handleRequestName)) && + TypesMatch(methodInfo, [requestType!, contextType, typeof(CancellationToken)]); + case (false, true): + return (methodInfo.Name == handleRequestName || methodInfo.Name.EndsWith("." + handleRequestName)) && + TypesMatch(methodInfo, [contextType, typeof(CancellationToken)]); + case (true, false): + return (methodInfo.Name == handleNotificationName || methodInfo.Name.EndsWith("." + handleNotificationName)) && + TypesMatch(methodInfo, [requestType!, contextType, typeof(CancellationToken)]); + case (false, false): + return (methodInfo.Name == handleNotificationName || methodInfo.Name.EndsWith("." + handleNotificationName)) && + TypesMatch(methodInfo, [contextType, typeof(CancellationToken)]); + } } - return methodInfo.GetCustomAttribute(); + bool TypesMatch(MethodInfo methodInfo, Type[] types) + { + var parameters = methodInfo.GetParameters(); + if (parameters.Length != types.Length) + return false; + + for (int i = 0, n = parameters.Length; i < n; i++) + { + if (!Equals(types[i], parameters[i].ParameterType)) + return false; + } + + return true; + } } static LanguageServerEndpointAttribute? GetMethodAttributeFromClassOrInterface(Type type)