use cached format options
This commit is contained in:
parent
2fd4948bd5
commit
dfd41e1368
3 changed files with 12 additions and 6 deletions
|
@ -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",
|
||||
|
|
|
@ -87,7 +87,13 @@ export default class FileConfigurationManager {
|
|||
}
|
||||
|
||||
public async ensureConfigurationForDocument(document: TextDocument, token: CancellationToken): Promise<void> {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue