From 5946299675284c4ef35a64cdfc33e1e0998abb68 Mon Sep 17 00:00:00 2001 From: chemzqm Date: Wed, 12 Jun 2019 20:42:41 +0800 Subject: [PATCH] support b:coc_tsserver_disable, closes #13 --- Readme.md | 2 ++ package.json | 2 +- src/server/features/bufferSyncSupport.ts | 3 +++ yarn.lock | 21 ++++++++++----------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Readme.md b/Readme.md index 49bea79..25c62f5 100644 --- a/Readme.md +++ b/Readme.md @@ -136,6 +136,8 @@ module will be used. Configurations are the same as with VSCode. Try completion with `tsserver`, `typescript` or `javascript` in your `coc-settings.json`. +To disable tsserver with spcified buffer, use `let b:coc_tsserver_disable = 1` on buffer create. + ## Related extensions - [coc-tslint-plugin](https://github.com/neoclide/coc-tslint-plugin): enable [tslint](https://github.com/palantir/tslint) diff --git a/package.json b/package.json index 032f477..6b64fe1 100644 --- a/package.json +++ b/package.json @@ -472,7 +472,7 @@ "@types/fast-diff": "^1.2.0", "@types/find-up": "^2.1.1", "@types/node": "^12.0.7", - "coc.nvim": "^0.0.69", + "coc.nvim": "0.0.70", "rimraf": "^2.6.3", "tslint": "^5.17.0" }, diff --git a/src/server/features/bufferSyncSupport.ts b/src/server/features/bufferSyncSupport.ts index 789104e..9c5d21c 100644 --- a/src/server/features/bufferSyncSupport.ts +++ b/src/server/features/bufferSyncSupport.ts @@ -199,6 +199,9 @@ export default class BufferSyncSupport { private onDidOpenTextDocument(document: TextDocument): void { if (!this.modeIds.has(document.languageId)) return let { uri } = document + let disable = workspace.getDocument(document.uri).getVar('tsserver_disable', 0) + if (disable) return + let filepath = this.client.toPath(uri) this.uris.add(uri) const args: Proto.OpenRequestArgs = { diff --git a/yarn.lock b/yarn.lock index fe71beb..278e004 100644 --- a/yarn.lock +++ b/yarn.lock @@ -81,11 +81,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -binary-search@1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/binary-search/-/binary-search-1.3.5.tgz#479ad009589e0273cf54e5d74ab1546c489078ce" - integrity sha512-RHFP0AdU6KAB0CCZsRMU2CJTk2EpL8GLURT+4gilpjr1f/7M91FgUMnXuQLmf3OKLet34gjuNFwO7e4agdX5pw== - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -115,13 +110,12 @@ chalk@^2.0.0, chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -coc.nvim@^0.0.69: - version "0.0.69" - resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.69.tgz#24c47ed7443ad3af6e0e7ce1134ee06759c543fb" - integrity sha512-TDVAO5VulbDexlUIpnwRVuiQ60hG2Zga99Fd8wJVpyCNCEPhyiVdY4Z4zAQb0zl8zDsqqb7Cm2qIPUA4ORbTIg== +coc.nvim@0.0.70: + version "0.0.70" + resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.70.tgz#8e891b77c75a3a3f6e602796092897563615db9f" + integrity sha512-tEunJhtQbvZYmYbiyJQH9S3/1wGmSgTtxstBiN8gpEAW4iasEvKHAhLd29fJlUzdG+1S4OQF9q9v862k68jqzQ== dependencies: "@chemzqm/neovim" "5.1.7" - binary-search "1.3.5" debounce "^1.2.0" fast-diff "^1.2.0" fb-watchman "^2.0.0" @@ -132,7 +126,7 @@ coc.nvim@^0.0.69: log4js "^4.3.1" minimatch "^3.0.4" semver "^6.1.1" - tslib "^1.9.3" + tslib "^1.10.0" uuid "^3.3.2" vscode-languageserver-protocol "^3.15.0-next.5" vscode-languageserver-types "^3.15.0-next.1" @@ -490,6 +484,11 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +tslib@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.3: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"