diff --git a/package.json b/package.json index c8bd588..4a97f46 100644 --- a/package.json +++ b/package.json @@ -913,7 +913,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^12.12.12", - "coc.nvim": "^0.0.81-next.11", + "coc.nvim": "^0.0.81-next.23", "esbuild": "^0.14.11", "semver": "^7.3.5", "vscode-languageserver-protocol": "^3.16.0", diff --git a/src/server/features/fileConfigurationManager.ts b/src/server/features/fileConfigurationManager.ts index 42d9acc..49184c0 100644 --- a/src/server/features/fileConfigurationManager.ts +++ b/src/server/features/fileConfigurationManager.ts @@ -87,7 +87,13 @@ export default class FileConfigurationManager { } public async ensureConfigurationForDocument(document: TextDocument, token: CancellationToken): Promise { - let opts = await workspace.getFormatOptions(document.uri) + let opts: { insertSpaces: boolean, tabSize: number } + let cached = this.cachedMap.get(document.uri) + if (cached) { + opts = { insertSpaces: cached.formatOptions.convertTabsToSpaces, tabSize: cached.formatOptions.tabSize } + } else { + opts = await workspace.getFormatOptions(document.uri) + } return this.ensureConfigurationOptions(document, opts.insertSpaces, opts.tabSize, token) } diff --git a/yarn.lock b/yarn.lock index d538c56..a37f5dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,10 +7,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.41.tgz#81d7734c5257da9f04354bd9084a6ebbdd5198a5" integrity sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q== -coc.nvim@^0.0.81-next.11: - version "0.0.81-next.11" - resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.11.tgz#2ac44f770da662adbaf30678edc837715016fe90" - integrity sha512-XxRRdpK67tVJH+zvwi4bHc9e/UJWBj2ZJdY8Q9/Twp0tgipDstoCqK3KeoszT79J7whPzS/1Y/8VG7dRNrMJ4w== +coc.nvim@^0.0.81-next.23: + version "0.0.81-next.23" + resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.23.tgz#48d8238afaaa0738c6237d8c077ba1791e2f90c6" + integrity sha512-RxNx6iRz7UvdgDeMVLyNXP6xe8GU8aY0Qxl/sBI+m2RzAJDRKCPuyFU1uOSxZntLglWtzKd87k3Byymdm19uBQ== esbuild-android-arm64@0.14.11: version "0.14.11"