From dea4c3a0c6380bf029d94b8f9f52eeb040c0e199 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Sat, 27 Aug 2022 12:28:53 +0800 Subject: [PATCH] ignore fugitive scheme Closes #395 --- src/server/features/bufferSyncSupport.ts | 8 ++++---- src/server/features/diagnostics.ts | 2 +- src/server/typescriptServiceClient.ts | 5 +++-- src/server/typescriptServiceClientHost.ts | 4 ++-- src/utils/fileSchemes.ts | 2 ++ 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/server/features/bufferSyncSupport.ts b/src/server/features/bufferSyncSupport.ts index a7ae050..1a8fecc 100644 --- a/src/server/features/bufferSyncSupport.ts +++ b/src/server/features/bufferSyncSupport.ts @@ -30,21 +30,21 @@ class CloseOperation { readonly type = BufferOperationType.Close; constructor( public readonly args: string - ) { } + ) {} } class OpenOperation { readonly type = BufferOperationType.Open; constructor( public readonly args: Proto.OpenRequestArgs - ) { } + ) {} } class ChangeOperation { readonly type = BufferOperationType.Change; constructor( public readonly args: Proto.FileCodeEdits - ) { } + ) {} } type BufferOperation = CloseOperation | OpenOperation | ChangeOperation @@ -59,7 +59,7 @@ class SyncedBuffer { public readonly filepath: string, private readonly client: ITypeScriptServiceClient, private readonly synchronizer: BufferSynchronizer, - ) { } + ) {} public open(): void { const args: Proto.OpenRequestArgs = { diff --git a/src/server/features/diagnostics.ts b/src/server/features/diagnostics.ts index 47f93af..9eb91b9 100644 --- a/src/server/features/diagnostics.ts +++ b/src/server/features/diagnostics.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { DiagnosticCollection, languages, workspace } from 'coc.nvim' +import { DiagnosticCollection, Uri, languages, workspace } from 'coc.nvim' import { Diagnostic, DiagnosticTag } from 'vscode-languageserver-protocol' import { ResourceMap } from './resourceMap' diff --git a/src/server/typescriptServiceClient.ts b/src/server/typescriptServiceClient.ts index 5c6c58c..54a172e 100644 --- a/src/server/typescriptServiceClient.ts +++ b/src/server/typescriptServiceClient.ts @@ -42,6 +42,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient private fileConfigurationManager: FileConfigurationManager private pathSeparator: string + private readonly emptyAuthority = 'ts-nul-authority' private tracer: Tracer private _configuration: TypeScriptServiceConfiguration private versionProvider: TypeScriptVersionProvider @@ -432,7 +433,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient public toResource(filepath: string): string { if (filepath.includes('zipfile:')) { - return filepath.replace(/.*zipfile:/, 'zipfile://'); + return filepath.replace(/.*zipfile:/, 'zipfile://') } if (this._apiVersion.gte(API.v213)) { if (filepath.startsWith(this.inMemoryResourcePrefix + 'untitled:')) { @@ -938,7 +939,7 @@ function getDiagnosticsKind(event: Proto.Event): DiagnosticKind { case 'suggestionDiag': return DiagnosticKind.Suggestion } - throw new Error('Unknown dignostics kind') + throw new Error('Unknown diagnostics kind') } const fenceCommands = new Set(['change', 'close', 'open']) diff --git a/src/server/typescriptServiceClientHost.ts b/src/server/typescriptServiceClientHost.ts index e081079..ed3585f 100644 --- a/src/server/typescriptServiceClientHost.ts +++ b/src/server/typescriptServiceClientHost.ts @@ -215,11 +215,11 @@ export default class TypeScriptServiceClientHost implements Disposable { language.diagnosticsReceived( kind, resource, - this.createMarkerDatas(diagnostics)) + this.createMarkerData(diagnostics)) } } - private createMarkerDatas(diagnostics: Proto.Diagnostic[]): (Diagnostic & { reportUnnecessary: any, reportDeprecated: any })[] { + private createMarkerData(diagnostics: Proto.Diagnostic[]): (Diagnostic & { reportUnnecessary: any, reportDeprecated: any })[] { return diagnostics.map(tsDiag => this.tsDiagnosticToLspDiagnostic(tsDiag)) } diff --git a/src/utils/fileSchemes.ts b/src/utils/fileSchemes.ts index ef1510d..e645ff4 100644 --- a/src/utils/fileSchemes.ts +++ b/src/utils/fileSchemes.ts @@ -6,6 +6,7 @@ export const file = 'file' export const untitled = 'untitled' export const git = 'git' +export const fugitive = 'fugitive' /** Live share scheme */ export const vsls = 'vsls' export const walkThroughSnippet = 'walkThroughSnippet' @@ -21,5 +22,6 @@ export const semanticSupportedSchemes = [ */ export const disabledSchemes = new Set([ git, + fugitive, vsls ])