diff --git a/Readme.md b/Readme.md index a29b158..00d1483 100644 --- a/Readme.md +++ b/Readme.md @@ -48,14 +48,15 @@ In your vim/neovim, run command: For yarn2 ( >= v2.0.0-rc.36) user want to use local typescript module: -- Run command `yarn dlx @yarnpkg/pnpify --sdk vim`, which will generate +- Run command `yarn dlx @yarnpkg/sdks vim`, which will generate `.vim/coc-settings.json`, with content: ```json { - "tsserver.tsdk": ".yarn/sdks/typescript/lib", "eslint.packageManager": "yarn", - "eslint.nodePath": ".yarn/sdks" + "eslint.nodePath": ".yarn/sdks", + "workspace.workspaceFolderCheckCwd": false, + "tsserver.tsdk": ".yarn/sdks/typescript/lib" } ``` diff --git a/package.json b/package.json index f1e7fe1..0fa5b64 100644 --- a/package.json +++ b/package.json @@ -314,6 +314,22 @@ "description": "Preferred path ending for auto imports.", "scope": "resource" }, + "typescript.preferences.jsxAttributeCompletionStyle": { + "type": "string", + "enum": [ + "auto", + "braces", + "none" + ], + "markdownEnumDescriptions": [ + "Insert `={}` or `=\"\"` after attribute names based on the prop type.", + "Insert `={}` after attribute names.", + "Only insert attribute names." + ], + "default": "auto", + "description": "Preferred style for JSX attribute completions.", + "scope": "resource" + }, "typescript.preferences.quoteStyle": { "type": "string", "default": "auto", @@ -524,6 +540,22 @@ "description": "Preferred path ending for auto imports.", "scope": "resource" }, + "javascript.preferences.jsxAttributeCompletionStyle": { + "type": "string", + "enum": [ + "auto", + "braces", + "none" + ], + "markdownEnumDescriptions": [ + "Insert `={}` or `=\"\"` after attribute names based on the prop type.", + "Insert `={}` after attribute names.", + "Only insert attribute names." + ], + "default": "auto", + "description": "Preferred style for JSX attribute completions.", + "scope": "resource" + }, "javascript.preferences.quoteStyle": { "type": "string", "default": "auto", diff --git a/src/server/features/fileConfigurationManager.ts b/src/server/features/fileConfigurationManager.ts index d465cff..6d83e56 100644 --- a/src/server/features/fileConfigurationManager.ts +++ b/src/server/features/fileConfigurationManager.ts @@ -176,6 +176,8 @@ export default class FileConfigurationManager { quotePreference: this.getQuoteStyle(config), importModuleSpecifierPreference: getImportModuleSpecifier(config) as any, importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config), + // @ts-expect-error until TS 4.5 protocol update + jsxAttributeCompletionStyle: getJsxAttributeCompletionStyle(config), allowTextChangesInNewFiles: uri.startsWith('file:'), allowRenameOfImportPath: true, providePrefixAndSuffixTextForRename: config.get('renameShorthandProperties', true) === false ? false : config.get('useAliasesForRenames', true), @@ -220,3 +222,11 @@ function getImportModuleSpecifierEndingPreference(config: WorkspaceConfiguration default: return 'auto' } } + +function getJsxAttributeCompletionStyle(config: WorkspaceConfiguration) { + switch (config.get('jsxAttributeCompletionStyle')) { + case 'braces': return 'braces' + case 'none': return 'none' + default: return 'auto' + } +}