feat: add jsxAttributeCompletionStyle settings (#319)
* docs: update yarn configuration (#311) * feat: add jsxAttributeCompletionStyle settings https://github.com/microsoft/vscode/pull/133920 Co-authored-by: KY64 <31939494+KY64@users.noreply.github.com>
This commit is contained in:
parent
c38a399405
commit
e4763a3820
3 changed files with 46 additions and 3 deletions
|
@ -48,14 +48,15 @@ In your vim/neovim, run command:
|
||||||
|
|
||||||
For yarn2 ( >= v2.0.0-rc.36) user want to use local typescript module:
|
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:
|
`.vim/coc-settings.json`, with content:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"tsserver.tsdk": ".yarn/sdks/typescript/lib",
|
|
||||||
"eslint.packageManager": "yarn",
|
"eslint.packageManager": "yarn",
|
||||||
"eslint.nodePath": ".yarn/sdks"
|
"eslint.nodePath": ".yarn/sdks",
|
||||||
|
"workspace.workspaceFolderCheckCwd": false,
|
||||||
|
"tsserver.tsdk": ".yarn/sdks/typescript/lib"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
32
package.json
32
package.json
|
@ -314,6 +314,22 @@
|
||||||
"description": "Preferred path ending for auto imports.",
|
"description": "Preferred path ending for auto imports.",
|
||||||
"scope": "resource"
|
"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": {
|
"typescript.preferences.quoteStyle": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "auto",
|
"default": "auto",
|
||||||
|
@ -524,6 +540,22 @@
|
||||||
"description": "Preferred path ending for auto imports.",
|
"description": "Preferred path ending for auto imports.",
|
||||||
"scope": "resource"
|
"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": {
|
"javascript.preferences.quoteStyle": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "auto",
|
"default": "auto",
|
||||||
|
|
|
@ -176,6 +176,8 @@ export default class FileConfigurationManager {
|
||||||
quotePreference: this.getQuoteStyle(config),
|
quotePreference: this.getQuoteStyle(config),
|
||||||
importModuleSpecifierPreference: getImportModuleSpecifier(config) as any,
|
importModuleSpecifierPreference: getImportModuleSpecifier(config) as any,
|
||||||
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
|
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(config),
|
||||||
|
// @ts-expect-error until TS 4.5 protocol update
|
||||||
|
jsxAttributeCompletionStyle: getJsxAttributeCompletionStyle(config),
|
||||||
allowTextChangesInNewFiles: uri.startsWith('file:'),
|
allowTextChangesInNewFiles: uri.startsWith('file:'),
|
||||||
allowRenameOfImportPath: true,
|
allowRenameOfImportPath: true,
|
||||||
providePrefixAndSuffixTextForRename: config.get<boolean>('renameShorthandProperties', true) === false ? false : config.get<boolean>('useAliasesForRenames', true),
|
providePrefixAndSuffixTextForRename: config.get<boolean>('renameShorthandProperties', true) === false ? false : config.get<boolean>('useAliasesForRenames', true),
|
||||||
|
@ -220,3 +222,11 @@ function getImportModuleSpecifierEndingPreference(config: WorkspaceConfiguration
|
||||||
default: return 'auto'
|
default: return 'auto'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getJsxAttributeCompletionStyle(config: WorkspaceConfiguration) {
|
||||||
|
switch (config.get<string>('jsxAttributeCompletionStyle')) {
|
||||||
|
case 'braces': return 'braces'
|
||||||
|
case 'none': return 'none'
|
||||||
|
default: return 'auto'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue