From 0e5132f041d60a182d63e2a34becd9bc62cfe2fb Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Fri, 20 Aug 2021 18:14:32 +0800 Subject: [PATCH 1/3] fix: getDiagnostics breaking changes (#307) --- package.json | 2 +- src/server/commands.ts | 3 ++- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0ff31ae..40a44e4 100644 --- a/package.json +++ b/package.json @@ -685,7 +685,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^10.12.0", - "coc.nvim": "^0.0.81-next.5", + "coc.nvim": "^0.0.81-next.6", "esbuild": "^0.8.29", "semver": "^7.3.2", "vscode-languageserver-protocol": "^3.16.0", diff --git a/src/server/commands.ts b/src/server/commands.ts index 78dfef0..23a7911 100644 --- a/src/server/commands.ts +++ b/src/server/commands.ts @@ -110,7 +110,8 @@ export class AutoFixCommand implements Command { return } let file = client.serviceClient.toPath(document.uri) - let diagnostics = diagnosticManager.getDiagnostics(document.uri).slice() as Diagnostic[] + let collectionDiags = diagnosticManager.getDiagnostics(document.uri) + let diagnostics = Array.isArray(collectionDiags) ? collectionDiags as Diagnostic[] : collectionDiags[this.service.id] let missingDiagnostics = diagnostics.filter(o => o.code == 2307) if (missingDiagnostics.length) { let names = missingDiagnostics.map(o => { diff --git a/yarn.lock b/yarn.lock index 76a495a..a598ef9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,10 +7,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.44.tgz#3945e6b702cb6403f22b779c8ea9e5c3f44ead40" integrity sha512-vHPAyBX1ffLcy4fQHmDyIUMUb42gHZjPHU66nhvbMzAWJqHnySGZ6STwN3rwrnSd1FHB0DI/RWgGELgKSYRDmw== -coc.nvim@^0.0.81-next.5: - version "0.0.81-next.5" - resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.5.tgz#b09bda5a2d527f7cd7bd786d4dee958160285e2b" - integrity sha512-NUTEWmjm9uKGBD8FNsj55PH1Xn4hD5uDCs7EdMoBpXWehq6/P1UoDZQfWXQv9HTq4zF/jH3g7KtZtl94VTlW4A== +coc.nvim@^0.0.81-next.6: + version "0.0.81-next.6" + resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.6.tgz#c3ee7079a66702ebb3b06d4c2bf333d9306ec561" + integrity sha512-VT+DhygyTIzu9IRrwCUljMzfNfh8TeXqqrvFsBE0E8cUwERgCAIvRbBMEDfqaaI+XFgyuwNRwbX5kEvfjG/u3g== esbuild@^0.8.29: version "0.8.29" From b530f9ee6f1bc87cf42e8e1d2edcda1a3884fc1d Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Fri, 20 Aug 2021 18:24:45 +0800 Subject: [PATCH 2/3] use diagnosticManager from tsserver client --- src/server/commands.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/commands.ts b/src/server/commands.ts index 23a7911..6d99712 100644 --- a/src/server/commands.ts +++ b/src/server/commands.ts @@ -1,4 +1,4 @@ -import { commands, diagnosticManager, CancellationToken, Diagnostic, Disposable, ServiceStat, Uri as URI, window, workspace } from 'coc.nvim' +import { commands, CancellationToken, Diagnostic, Disposable, ServiceStat, Uri as URI, window, workspace } from 'coc.nvim' import { Location, Position, Range, TextEdit } from 'vscode-languageserver-types' import TsserverService from '../server' import { PluginManager } from '../utils/plugins' @@ -110,8 +110,7 @@ export class AutoFixCommand implements Command { return } let file = client.serviceClient.toPath(document.uri) - let collectionDiags = diagnosticManager.getDiagnostics(document.uri) - let diagnostics = Array.isArray(collectionDiags) ? collectionDiags as Diagnostic[] : collectionDiags[this.service.id] + let diagnostics = client.serviceClient.diagnosticsManager.getDiagnostics(document.uri) let missingDiagnostics = diagnostics.filter(o => o.code == 2307) if (missingDiagnostics.length) { let names = missingDiagnostics.map(o => { From 68bb4634f345b70c8b2e8c48294dd3619eb5b810 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Fri, 20 Aug 2021 18:25:07 +0800 Subject: [PATCH 3/3] Release 1.8.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40a44e4..b09a907 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coc-tsserver", - "version": "1.8.5", + "version": "1.8.6", "description": "tsserver extension for coc.nvim", "main": "lib/index.js", "publisher": "chemzqm",