From f4365bd88a5592c8f8648819e473e0dba3be10bd Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Wed, 18 May 2022 15:59:34 +0200 Subject: [PATCH] Prefer vscode-languageserver-types imports (#593) --- src/languageserver/commandExecutor.ts | 2 +- .../handlers/languageHandlers.ts | 21 ++++++++++++------- src/languageserver/telemetry.ts | 2 +- src/languageservice/parser/jsonParser07.ts | 3 +-- .../services/yamlCodeActions.ts | 5 ++--- src/languageservice/services/yamlCodeLens.ts | 4 +--- src/languageservice/services/yamlCommands.ts | 2 +- .../services/yamlCompletion.ts | 4 ++-- .../services/yamlDefinition.ts | 4 ++-- src/languageservice/services/yamlFolding.ts | 2 +- src/languageservice/services/yamlLinks.ts | 2 +- .../services/yamlOnTypeFormatting.ts | 3 ++- .../services/yamlValidation.ts | 2 +- src/languageservice/utils/paths.ts | 2 +- src/languageservice/utils/ranges.ts | 2 +- src/languageservice/utils/schemaUrls.ts | 2 +- src/languageservice/utils/textBuffer.ts | 2 +- src/languageservice/yamlLanguageService.ts | 13 ++++++------ src/yamlSettings.ts | 2 +- test/autoCompletion.test.ts | 2 +- test/autoCompletionFix.test.ts | 2 +- test/customTags.test.ts | 2 +- test/defaultSnippets.test.ts | 2 +- test/documentSymbols.test.ts | 2 +- test/findLinks.test.ts | 2 +- test/formatter.test.ts | 2 +- test/hover.test.ts | 2 +- test/integration.test.ts | 2 +- test/jsonParser.test.ts | 3 +-- test/multipleDocuments.test.ts | 2 +- test/paths.test.ts | 2 +- test/schema.test.ts | 2 +- test/schemaValidation.test.ts | 2 +- test/textBuffer.test.ts | 2 +- test/utils/testsTypes.ts | 2 +- test/utils/verifyError.ts | 14 +++++++++++-- test/yamlCodeActions.test.ts | 5 ++--- test/yamlCodeLens.test.ts | 14 ++++++------- test/yamlCommands.test.ts | 2 +- test/yamlDefinition.test.ts | 2 +- test/yamlFolding.test.ts | 2 +- test/yamlOnTypeFormatting.test.ts | 3 ++- 42 files changed, 83 insertions(+), 71 deletions(-) diff --git a/src/languageserver/commandExecutor.ts b/src/languageserver/commandExecutor.ts index 3e6b88a6..177c048d 100644 --- a/src/languageserver/commandExecutor.ts +++ b/src/languageserver/commandExecutor.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ExecuteCommandParams } from 'vscode-languageserver'; +import { ExecuteCommandParams } from 'vscode-languageserver-protocol'; export interface CommandHandler { (...args: unknown[]): void; diff --git a/src/languageserver/handlers/languageHandlers.ts b/src/languageserver/handlers/languageHandlers.ts index 8ecc3690..148ad51f 100644 --- a/src/languageserver/handlers/languageHandlers.ts +++ b/src/languageserver/handlers/languageHandlers.ts @@ -3,23 +3,30 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { FoldingRange } from 'vscode-json-languageservice'; +import { Connection } from 'vscode-languageserver'; import { - CodeAction, CodeActionParams, - CompletionList, DidChangeWatchedFilesParams, DocumentFormattingParams, - DocumentLink, DocumentLinkParams, DocumentOnTypeFormattingParams, DocumentSymbolParams, FoldingRangeParams, - Connection, TextDocumentPositionParams, CodeLensParams, DefinitionParams, -} from 'vscode-languageserver'; -import { CodeLens, DefinitionLink, DocumentSymbol, Hover, SymbolInformation, TextEdit } from 'vscode-languageserver-types'; +} from 'vscode-languageserver-protocol'; +import { + CodeAction, + CodeLens, + CompletionList, + DefinitionLink, + DocumentLink, + DocumentSymbol, + Hover, + SymbolInformation, + TextEdit, +} from 'vscode-languageserver-types'; import { isKubernetesAssociatedDocument } from '../../languageservice/parser/isKubernetes'; import { LanguageService } from '../../languageservice/yamlLanguageService'; import { SettingsState } from '../../yamlSettings'; @@ -214,7 +221,7 @@ export class LanguageHandlers { if (!textDocument) { return; } - return this.languageService.getCodeLens(textDocument, params); + return this.languageService.getCodeLens(textDocument); } codeLensResolveHandler(param: CodeLens): Thenable | CodeLens { diff --git a/src/languageserver/telemetry.ts b/src/languageserver/telemetry.ts index 44b0e8f0..9330101f 100644 --- a/src/languageserver/telemetry.ts +++ b/src/languageserver/telemetry.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Connection } from 'vscode-languageserver/lib/common/server'; +import { Connection } from 'vscode-languageserver'; /** * Due to LSP limitation this object must be JSON serializable diff --git a/src/languageservice/parser/jsonParser07.ts b/src/languageservice/parser/jsonParser07.ts index 96937b0e..d841f024 100644 --- a/src/languageservice/parser/jsonParser07.ts +++ b/src/languageservice/parser/jsonParser07.ts @@ -21,9 +21,8 @@ import { import { ErrorCode } from 'vscode-json-languageservice'; import * as nls from 'vscode-nls'; import { URI } from 'vscode-uri'; -import { DiagnosticSeverity, Range } from 'vscode-languageserver-types'; +import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { Diagnostic } from 'vscode-languageserver'; import { isArrayEqual } from '../utils/arrUtils'; import { Node, Pair } from 'yaml'; import { safeCreateUnicodeRegExp } from '../utils/strings'; diff --git a/src/languageservice/services/yamlCodeActions.ts b/src/languageservice/services/yamlCodeActions.ts index 1c5db320..57360c74 100644 --- a/src/languageservice/services/yamlCodeActions.ts +++ b/src/languageservice/services/yamlCodeActions.ts @@ -5,17 +5,16 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { - ClientCapabilities, CodeAction, CodeActionKind, - CodeActionParams, Command, Diagnostic, Position, Range, TextEdit, WorkspaceEdit, -} from 'vscode-languageserver'; +} from 'vscode-languageserver-types'; +import { ClientCapabilities, CodeActionParams } from 'vscode-languageserver-protocol'; import { YamlCommands } from '../../commands'; import * as path from 'path'; import { TextBuffer } from '../utils/textBuffer'; diff --git a/src/languageservice/services/yamlCodeLens.ts b/src/languageservice/services/yamlCodeLens.ts index 1a53e6a8..d07ca407 100644 --- a/src/languageservice/services/yamlCodeLens.ts +++ b/src/languageservice/services/yamlCodeLens.ts @@ -11,7 +11,6 @@ import { YAMLSchemaService } from './yamlSchemaService'; import { URI } from 'vscode-uri'; import * as path from 'path'; import { JSONSchema } from '../jsonSchema'; -import { CodeLensParams } from 'vscode-languageserver-protocol'; import { Telemetry } from '../../languageserver/telemetry'; import { getSchemaUrls } from '../utils/schemaUrls'; import { convertErrorToTelemetryMsg } from '../utils/objects'; @@ -19,8 +18,7 @@ import { convertErrorToTelemetryMsg } from '../utils/objects'; export class YamlCodeLens { constructor(private schemaService: YAMLSchemaService, private readonly telemetry: Telemetry) {} - // eslint-disable-next-line @typescript-eslint/no-unused-vars - async getCodeLens(document: TextDocument, params: CodeLensParams): Promise { + async getCodeLens(document: TextDocument): Promise { const result = []; try { const yamlDocument = yamlDocumentsCache.getYamlDocument(document); diff --git a/src/languageservice/services/yamlCommands.ts b/src/languageservice/services/yamlCommands.ts index 776bcd9f..b1a2d09c 100644 --- a/src/languageservice/services/yamlCommands.ts +++ b/src/languageservice/services/yamlCommands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Connection } from 'vscode-languageserver/node'; +import { Connection } from 'vscode-languageserver'; import { YamlCommands } from '../../commands'; import { CommandExecutor } from '../../languageserver/commandExecutor'; import { URI } from 'vscode-uri'; diff --git a/src/languageservice/services/yamlCompletion.ts b/src/languageservice/services/yamlCompletion.ts index 0d10b0cb..6c312133 100644 --- a/src/languageservice/services/yamlCompletion.ts +++ b/src/languageservice/services/yamlCompletion.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { TextDocument } from 'vscode-languageserver-textdocument'; +import { ClientCapabilities } from 'vscode-languageserver'; import { - ClientCapabilities, CompletionItem as CompletionItemBase, CompletionItemKind, CompletionList, @@ -16,7 +16,7 @@ import { Position, Range, TextEdit, -} from 'vscode-languageserver/node'; +} from 'vscode-languageserver-types'; import { Node, isPair, isScalar, isMap, YAMLMap, isSeq, YAMLSeq, isNode, Pair } from 'yaml'; import { Telemetry } from '../../languageserver/telemetry'; import { SingleYAMLDocument, YamlDocuments } from '../parser/yaml-documents'; diff --git a/src/languageservice/services/yamlDefinition.ts b/src/languageservice/services/yamlDefinition.ts index eb2fbff3..6f299ac1 100644 --- a/src/languageservice/services/yamlDefinition.ts +++ b/src/languageservice/services/yamlDefinition.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DefinitionParams, LocationLink, Range } from 'vscode-languageserver-protocol'; +import { DefinitionParams } from 'vscode-languageserver-protocol'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { DefinitionLink } from 'vscode-languageserver-types'; +import { DefinitionLink, LocationLink, Range } from 'vscode-languageserver-types'; import { isAlias } from 'yaml'; import { Telemetry } from '../../languageserver/telemetry'; import { yamlDocumentsCache } from '../parser/yaml-documents'; diff --git a/src/languageservice/services/yamlFolding.ts b/src/languageservice/services/yamlFolding.ts index 09ae3e67..bada72d5 100644 --- a/src/languageservice/services/yamlFolding.ts +++ b/src/languageservice/services/yamlFolding.ts @@ -2,7 +2,7 @@ * Copyright (c) Red Hat, Inc. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { FoldingRange, Range } from 'vscode-languageserver'; +import { FoldingRange, Range } from 'vscode-languageserver-types'; import { FoldingRangesContext } from '../yamlTypes'; import { ASTNode } from '../jsonASTTypes'; import { yamlDocumentsCache } from '../parser/yaml-documents'; diff --git a/src/languageservice/services/yamlLinks.ts b/src/languageservice/services/yamlLinks.ts index 7c1cc01b..09d89fd5 100644 --- a/src/languageservice/services/yamlLinks.ts +++ b/src/languageservice/services/yamlLinks.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { findLinks as JSONFindLinks } from 'vscode-json-languageservice/lib/umd/services/jsonLinks'; -import { DocumentLink } from 'vscode-languageserver'; +import { DocumentLink } from 'vscode-languageserver-types'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { Telemetry } from '../../languageserver/telemetry'; import { yamlDocumentsCache } from '../parser/yaml-documents'; diff --git a/src/languageservice/services/yamlOnTypeFormatting.ts b/src/languageservice/services/yamlOnTypeFormatting.ts index 638382b5..94c4dbca 100644 --- a/src/languageservice/services/yamlOnTypeFormatting.ts +++ b/src/languageservice/services/yamlOnTypeFormatting.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DocumentOnTypeFormattingParams, Position, Range, TextEdit } from 'vscode-languageserver'; +import { DocumentOnTypeFormattingParams } from 'vscode-languageserver'; +import { Position, Range, TextEdit } from 'vscode-languageserver-types'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { TextBuffer } from '../utils/textBuffer'; diff --git a/src/languageservice/services/yamlValidation.ts b/src/languageservice/services/yamlValidation.ts index 6c48a329..aa157093 100644 --- a/src/languageservice/services/yamlValidation.ts +++ b/src/languageservice/services/yamlValidation.ts @@ -5,7 +5,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { Diagnostic, Position } from 'vscode-languageserver'; +import { Diagnostic, Position } from 'vscode-languageserver-types'; import { LanguageSettings } from '../yamlLanguageService'; import { YAMLDocument, YamlVersion } from '../parser/yamlParser07'; import { SingleYAMLDocument } from '../parser/yamlParser07'; diff --git a/src/languageservice/utils/paths.ts b/src/languageservice/utils/paths.ts index f7081ff4..964e2231 100644 --- a/src/languageservice/utils/paths.ts +++ b/src/languageservice/utils/paths.ts @@ -1,4 +1,4 @@ -import { WorkspaceFolder, WorkspaceFoldersChangeEvent } from 'vscode-languageserver'; +import { WorkspaceFolder, WorkspaceFoldersChangeEvent } from 'vscode-languageserver-protocol'; import { join, normalize, sep } from 'path'; import { URI } from 'vscode-uri'; diff --git a/src/languageservice/utils/ranges.ts b/src/languageservice/utils/ranges.ts index 61ebadbf..8e029110 100644 --- a/src/languageservice/utils/ranges.ts +++ b/src/languageservice/utils/ranges.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Range } from 'vscode-languageserver'; +import { Range } from 'vscode-languageserver-types'; /** * Check if rangeA and rangeB is intersect diff --git a/src/languageservice/utils/schemaUrls.ts b/src/languageservice/utils/schemaUrls.ts index 0ca318e5..49672347 100644 --- a/src/languageservice/utils/schemaUrls.ts +++ b/src/languageservice/utils/schemaUrls.ts @@ -1,4 +1,4 @@ -import { WorkspaceFolder } from 'vscode-languageserver'; +import { WorkspaceFolder } from 'vscode-languageserver-protocol'; import { URI } from 'vscode-uri'; import { Telemetry } from '../../languageserver/telemetry'; import { JSONSchema, JSONSchemaRef } from '../jsonSchema'; diff --git a/src/languageservice/utils/textBuffer.ts b/src/languageservice/utils/textBuffer.ts index d8172b3d..014c991d 100644 --- a/src/languageservice/utils/textBuffer.ts +++ b/src/languageservice/utils/textBuffer.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextDocument } from 'vscode-json-languageservice'; +import { TextDocument } from 'vscode-languageserver-textdocument'; import { Position, Range } from 'vscode-languageserver-types'; interface FullTextDocument { diff --git a/src/languageservice/yamlLanguageService.ts b/src/languageservice/yamlLanguageService.ts index d65111db..78066852 100644 --- a/src/languageservice/yamlLanguageService.ts +++ b/src/languageservice/yamlLanguageService.ts @@ -13,11 +13,13 @@ import { } from './services/yamlSchemaService'; import { Position, + CodeAction, CompletionList, Diagnostic, Hover, SymbolInformation, DocumentSymbol, + FoldingRange, TextEdit, DocumentLink, CodeLens, @@ -31,15 +33,12 @@ import { YAMLFormatter } from './services/yamlFormatter'; import { DocumentSymbolsContext } from 'vscode-json-languageservice'; import { YamlLinks } from './services/yamlLinks'; import { - FoldingRange, ClientCapabilities, CodeActionParams, - CodeAction, Connection, DocumentOnTypeFormattingParams, - CodeLensParams, DefinitionParams, -} from 'vscode-languageserver/node'; +} from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { getFoldingRanges } from './services/yamlFolding'; import { FoldingRangesContext, SchemaVersions } from './yamlTypes'; @@ -165,7 +164,7 @@ export interface LanguageService { deleteSchemasWhole(schemaDeletions: SchemaDeletionsAll): void; getFoldingRanges(document: TextDocument, context: FoldingRangesContext): FoldingRange[] | null; getCodeAction(document: TextDocument, params: CodeActionParams): CodeAction[] | undefined; - getCodeLens(document: TextDocument, params: CodeLensParams): Thenable | CodeLens[] | undefined; + getCodeLens(document: TextDocument): Thenable | CodeLens[] | undefined; resolveCodeLens(param: CodeLens): Thenable | CodeLens; } @@ -250,8 +249,8 @@ export function getLanguageService( getCodeAction: (document, params) => { return yamlCodeActions.getCodeAction(document, params); }, - getCodeLens: (document, params) => { - return yamlCodeLens.getCodeLens(document, params); + getCodeLens: (document) => { + return yamlCodeLens.getCodeLens(document); }, resolveCodeLens: (param) => yamlCodeLens.resolveCodeLens(param), }; diff --git a/src/yamlSettings.ts b/src/yamlSettings.ts index 6952aa78..2d9a0d58 100644 --- a/src/yamlSettings.ts +++ b/src/yamlSettings.ts @@ -1,4 +1,4 @@ -import { TextDocuments, Disposable, ClientCapabilities, WorkspaceFolder } from 'vscode-languageserver/node'; +import { TextDocuments, Disposable, ClientCapabilities, WorkspaceFolder } from 'vscode-languageserver'; import { CustomFormatterOptions, SchemaConfiguration } from './languageservice/yamlLanguageService'; import { ISchemaAssociations } from './requestTypes'; import { URI } from 'vscode-uri'; diff --git a/test/autoCompletion.test.ts b/test/autoCompletion.test.ts index 15c4cf38..048cf0d1 100644 --- a/test/autoCompletion.test.ts +++ b/test/autoCompletion.test.ts @@ -9,7 +9,7 @@ import assert = require('assert'); import path = require('path'); import { createExpectedCompletion } from './utils/verifyError'; import { ServiceSetup } from './utils/serviceSetup'; -import { CompletionList, InsertTextFormat, MarkupContent, MarkupKind, Position } from 'vscode-languageserver'; +import { CompletionList, InsertTextFormat, MarkupContent, MarkupKind, Position } from 'vscode-languageserver-types'; import { expect } from 'chai'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { LanguageService } from '../src'; diff --git a/test/autoCompletionFix.test.ts b/test/autoCompletionFix.test.ts index 9d072370..ae8685ca 100644 --- a/test/autoCompletionFix.test.ts +++ b/test/autoCompletionFix.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CompletionList, Position, Range } from 'vscode-languageserver/node'; +import { CompletionList, Position, Range } from 'vscode-languageserver-types'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; import { LanguageService } from '../src/languageservice/yamlLanguageService'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; diff --git a/test/customTags.test.ts b/test/customTags.test.ts index 56e63626..f696fcd4 100644 --- a/test/customTags.test.ts +++ b/test/customTags.test.ts @@ -6,7 +6,7 @@ import { setupLanguageService, setupTextDocument } from './utils/testHelper'; import { ServiceSetup } from './utils/serviceSetup'; import { createExpectedError } from './utils/verifyError'; import * as assert from 'assert'; -import { Diagnostic } from 'vscode-languageserver'; +import { Diagnostic } from 'vscode-languageserver-types'; import { LanguageService } from '../src/languageservice/yamlLanguageService'; import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; diff --git a/test/defaultSnippets.test.ts b/test/defaultSnippets.test.ts index 6dda545b..d47776fa 100644 --- a/test/defaultSnippets.test.ts +++ b/test/defaultSnippets.test.ts @@ -8,7 +8,7 @@ import path = require('path'); import { ServiceSetup } from './utils/serviceSetup'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { CompletionList, TextEdit } from 'vscode-languageserver'; +import { CompletionList, TextEdit } from 'vscode-languageserver-types'; import { expect } from 'chai'; describe('Default Snippet Tests', () => { diff --git a/test/documentSymbols.test.ts b/test/documentSymbols.test.ts index c758d4c9..761b634b 100644 --- a/test/documentSymbols.test.ts +++ b/test/documentSymbols.test.ts @@ -11,7 +11,7 @@ import { import { DocumentSymbol, SymbolKind } from 'vscode-languageserver-types'; import assert = require('assert'); import { ServiceSetup } from './utils/serviceSetup'; -import { SymbolInformation } from 'vscode-languageserver'; +import { SymbolInformation } from 'vscode-languageserver-types'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; diff --git a/test/findLinks.test.ts b/test/findLinks.test.ts index 48767a9b..18260a55 100644 --- a/test/findLinks.test.ts +++ b/test/findLinks.test.ts @@ -5,7 +5,7 @@ import { setupLanguageService, setupTextDocument } from './utils/testHelper'; import assert = require('assert'); import { ServiceSetup } from './utils/serviceSetup'; -import { DocumentLink } from 'vscode-languageserver'; +import { DocumentLink } from 'vscode-languageserver-types'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; diff --git a/test/formatter.test.ts b/test/formatter.test.ts index 7d0cba25..ed970a00 100644 --- a/test/formatter.test.ts +++ b/test/formatter.test.ts @@ -5,7 +5,7 @@ import { setupLanguageService, setupTextDocument } from './utils/testHelper'; import { ServiceSetup } from './utils/serviceSetup'; import * as assert from 'assert'; -import { TextEdit } from 'vscode-languageserver'; +import { TextEdit } from 'vscode-languageserver-types'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; diff --git a/test/hover.test.ts b/test/hover.test.ts index a4e41577..17028735 100644 --- a/test/hover.test.ts +++ b/test/hover.test.ts @@ -6,7 +6,7 @@ import { ServiceSetup } from './utils/serviceSetup'; import { SCHEMA_ID, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper'; import { LanguageService } from '../src'; import * as assert from 'assert'; -import { Hover, MarkupContent, Position } from 'vscode-languageserver'; +import { Hover, MarkupContent, Position } from 'vscode-languageserver-types'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { expect } from 'chai'; diff --git a/test/integration.test.ts b/test/integration.test.ts index 70a69524..aa73a890 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { setupLanguageService, setupTextDocument } from './utils/testHelper'; import * as assert from 'assert'; -import { Diagnostic, CompletionList, Hover, MarkupContent } from 'vscode-languageserver'; +import { Diagnostic, CompletionList, Hover, MarkupContent } from 'vscode-languageserver-types'; import { ServiceSetup } from './utils/serviceSetup'; import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; diff --git a/test/jsonParser.test.ts b/test/jsonParser.test.ts index dd979f54..0ef55a2e 100644 --- a/test/jsonParser.test.ts +++ b/test/jsonParser.test.ts @@ -9,8 +9,7 @@ import { getNodeValue, JSONDocument } from './../src/languageservice/parser/json import * as JsonSchema from './../src/languageservice/jsonSchema'; import { ASTNode, ObjectASTNode } from './../src/languageservice/jsonASTTypes'; import { ErrorCode, getLanguageService } from 'vscode-json-languageservice'; -import { TextDocument, Range } from 'vscode-languageserver-types'; -import { Diagnostic } from 'vscode-languageserver'; +import { Diagnostic, TextDocument, Range } from 'vscode-languageserver-types'; describe('JSON Parser', () => { function isValid(json: string): void { diff --git a/test/multipleDocuments.test.ts b/test/multipleDocuments.test.ts index b6d50311..476f9d73 100644 --- a/test/multipleDocuments.test.ts +++ b/test/multipleDocuments.test.ts @@ -6,7 +6,7 @@ import * as path from 'path'; import { setupLanguageService, setupTextDocument, toFsPath } from './utils/testHelper'; import * as assert from 'assert'; import { ServiceSetup } from './utils/serviceSetup'; -import { Diagnostic, Hover, MarkupContent } from 'vscode-languageserver'; +import { Diagnostic, Hover, MarkupContent } from 'vscode-languageserver-types'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { LanguageService } from '../src/languageservice/yamlLanguageService'; import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; diff --git a/test/paths.test.ts b/test/paths.test.ts index 93198655..73488fc9 100644 --- a/test/paths.test.ts +++ b/test/paths.test.ts @@ -1,5 +1,5 @@ import * as assert from 'assert'; -import { WorkspaceFolder } from 'vscode-languageserver'; +import { WorkspaceFolder } from 'vscode-languageserver-protocol'; import { join } from 'path'; import { relativeToAbsolutePath, isRelativePath, workspaceFoldersChanged } from '../src/languageservice/utils/paths'; diff --git a/test/schema.test.ts b/test/schema.test.ts index 1d6110b0..46a04c74 100644 --- a/test/schema.test.ts +++ b/test/schema.test.ts @@ -13,7 +13,7 @@ import { expect } from 'chai'; import { ServiceSetup } from './utils/serviceSetup'; import { setupLanguageService, setupTextDocument, TEST_URI } from './utils/testHelper'; import { LanguageService, SchemaPriority } from '../src'; -import { MarkupContent, Position } from 'vscode-languageserver'; +import { MarkupContent, Position } from 'vscode-languageserver-types'; import { LineCounter } from 'yaml'; import { getSchemaFromModeline } from '../src/languageservice/services/modelineUtil'; diff --git a/test/schemaValidation.test.ts b/test/schemaValidation.test.ts index af1a08c7..a1322079 100644 --- a/test/schemaValidation.test.ts +++ b/test/schemaValidation.test.ts @@ -18,7 +18,7 @@ import { } from './utils/errorMessages'; import * as assert from 'assert'; import * as path from 'path'; -import { Diagnostic, DiagnosticSeverity, Position } from 'vscode-languageserver'; +import { Diagnostic, DiagnosticSeverity, Position } from 'vscode-languageserver-types'; import { expect } from 'chai'; import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; diff --git a/test/textBuffer.test.ts b/test/textBuffer.test.ts index 6e5a38da..93f7f802 100644 --- a/test/textBuffer.test.ts +++ b/test/textBuffer.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { TextBuffer } from '../src/languageservice/utils/textBuffer'; -import { TextDocument } from 'vscode-languageserver'; +import { TextDocument } from 'vscode-languageserver-textdocument'; import * as assert from 'assert'; describe('TextBuffer', () => { diff --git a/test/utils/testsTypes.ts b/test/utils/testsTypes.ts index 8b611098..c4daa256 100644 --- a/test/utils/testsTypes.ts +++ b/test/utils/testsTypes.ts @@ -15,7 +15,7 @@ import { RenameFilesParams, DeleteFilesParams, } from 'vscode-languageserver-protocol'; -import { Connection, RemoteWorkspace } from 'vscode-languageserver/lib/common/server'; +import { Connection, RemoteWorkspace } from 'vscode-languageserver'; import { Telemetry, TelemetryEvent } from '../../src/languageserver/telemetry'; /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/test/utils/verifyError.ts b/test/utils/verifyError.ts index 8dfa910d..7d42d78d 100644 --- a/test/utils/verifyError.ts +++ b/test/utils/verifyError.ts @@ -3,8 +3,18 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DocumentSymbol, SymbolKind, InsertTextFormat, Range, DiagnosticTag } from 'vscode-languageserver-types'; -import { CompletionItem, CompletionItemKind, SymbolInformation, Diagnostic, DiagnosticSeverity } from 'vscode-languageserver'; +import { + CompletionItem, + CompletionItemKind, + Diagnostic, + DiagnosticSeverity, + DiagnosticTag, + DocumentSymbol, + InsertTextFormat, + Range, + SymbolKind, + SymbolInformation, +} from 'vscode-languageserver-types'; import { ErrorCode } from 'vscode-json-languageservice'; export function createExpectedError( diff --git a/test/yamlCodeActions.test.ts b/test/yamlCodeActions.test.ts index 004152de..298082f3 100644 --- a/test/yamlCodeActions.test.ts +++ b/test/yamlCodeActions.test.ts @@ -8,16 +8,15 @@ import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; import { YamlCodeActions } from '../src/languageservice/services/yamlCodeActions'; import { - ClientCapabilities, CodeAction, CodeActionContext, - CodeActionParams, Command, Range, TextDocumentIdentifier, TextEdit, WorkspaceEdit, -} from 'vscode-languageserver'; +} from 'vscode-languageserver-types'; +import { ClientCapabilities, CodeActionParams } from 'vscode-languageserver'; import { setupTextDocument, TEST_URI } from './utils/testHelper'; import { createDiagnosticWithData, createExpectedError, createUnusedAnchorDiagnostic } from './utils/verifyError'; import { YamlCommands } from '../src/commands'; diff --git a/test/yamlCodeLens.test.ts b/test/yamlCodeLens.test.ts index dc28c2a2..9e0ee81d 100644 --- a/test/yamlCodeLens.test.ts +++ b/test/yamlCodeLens.test.ts @@ -53,7 +53,7 @@ describe('YAML CodeLens', () => { }; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result).is.not.empty; expect(result[0].command).is.not.undefined; expect(result[0].command).is.deep.equal( @@ -68,7 +68,7 @@ describe('YAML CodeLens', () => { }; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result[0].range).is.deep.equal(Range.create(0, 0, 0, 0)); expect(result[0].command).is.deep.equal( createCommand('schema.json', YamlCommands.JUMP_TO_SCHEMA, 'some://url/to/schema.json') @@ -82,7 +82,7 @@ describe('YAML CodeLens', () => { }; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result.length).to.eq(1); expect(result[0].range).is.deep.equal(Range.create(0, 0, 0, 0)); expect(result[0].command).is.deep.equal( @@ -98,7 +98,7 @@ describe('YAML CodeLens', () => { } as JSONSchema; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result[0].command).is.deep.equal( createCommand('fooBar (schema.json)', YamlCommands.JUMP_TO_SCHEMA, 'some://url/to/schema.json') ); @@ -118,7 +118,7 @@ describe('YAML CodeLens', () => { } as JSONSchema; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result).has.length(2); expect(result).is.deep.equal([ createCodeLens('schema1.json', YamlCommands.JUMP_TO_SCHEMA, 'some://url/schema1.json'), @@ -140,7 +140,7 @@ describe('YAML CodeLens', () => { } as JSONSchema; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result).has.length(2); expect(result).is.deep.equal([ createCodeLens('schema1.json', YamlCommands.JUMP_TO_SCHEMA, 'some://url/schema1.json'), @@ -162,7 +162,7 @@ describe('YAML CodeLens', () => { } as JSONSchema; yamlSchemaService.getSchemaForResource.resolves({ schema }); const codeLens = new YamlCodeLens((yamlSchemaService as unknown) as YAMLSchemaService, telemetry); - const result = await codeLens.getCodeLens(doc, { textDocument: { uri: doc.uri } }); + const result = await codeLens.getCodeLens(doc); expect(result).has.length(2); expect(result).is.deep.equal([ createCodeLens('schema1.json', YamlCommands.JUMP_TO_SCHEMA, 'some://url/schema1.json'), diff --git a/test/yamlCommands.test.ts b/test/yamlCommands.test.ts index 7db2b9a9..cea62194 100644 --- a/test/yamlCommands.test.ts +++ b/test/yamlCommands.test.ts @@ -8,7 +8,7 @@ import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; import { registerCommands } from '../src/languageservice/services/yamlCommands'; import { commandExecutor } from '../src/languageserver/commandExecutor'; -import { Connection } from 'vscode-languageserver/node'; +import { Connection } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; const expect = chai.expect; diff --git a/test/yamlDefinition.test.ts b/test/yamlDefinition.test.ts index d6c29153..a8b2b361 100644 --- a/test/yamlDefinition.test.ts +++ b/test/yamlDefinition.test.ts @@ -6,7 +6,7 @@ import { setupTextDocument, TEST_URI } from './utils/testHelper'; import { expect } from 'chai'; import { YamlDefinition } from '../src/languageservice/services/yamlDefinition'; -import { LocationLink, Position, Range } from 'vscode-languageserver-protocol'; +import { LocationLink, Position, Range } from 'vscode-languageserver-types'; import { Telemetry } from '../src/languageserver/telemetry'; describe('YAML Definition', () => { diff --git a/test/yamlFolding.test.ts b/test/yamlFolding.test.ts index 24fab9f0..a3f6f30c 100644 --- a/test/yamlFolding.test.ts +++ b/test/yamlFolding.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { expect } from 'chai'; -import { FoldingRange } from 'vscode-languageserver'; +import { FoldingRange } from 'vscode-languageserver-types'; import { getFoldingRanges } from '../src/languageservice/services/yamlFolding'; import { FoldingRangesContext } from '../src/languageservice/yamlTypes'; import { setupTextDocument, TEST_URI } from './utils/testHelper'; diff --git a/test/yamlOnTypeFormatting.test.ts b/test/yamlOnTypeFormatting.test.ts index bc40ea92..6984a481 100644 --- a/test/yamlOnTypeFormatting.test.ts +++ b/test/yamlOnTypeFormatting.test.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { expect } from 'chai'; -import { DocumentOnTypeFormattingParams, FormattingOptions, Position, Range, TextEdit } from 'vscode-languageserver'; +import { DocumentOnTypeFormattingParams } from 'vscode-languageserver-protocol'; +import { FormattingOptions, Position, Range, TextEdit } from 'vscode-languageserver-types'; import { doDocumentOnTypeFormatting } from '../src/languageservice/services/yamlOnTypeFormatting'; import { setupTextDocument } from './utils/testHelper';