diff --git a/Readme.md b/Readme.md index c9229fb..6fc895c 100644 --- a/Readme.md +++ b/Readme.md @@ -159,6 +159,9 @@ for guide of coc.nvim's configuration. - `typescript.suggest.classMemberSnippets.enabled`: Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace, default: `true` +- `typescript.suggest.jsdoc.generateReturns`: Enable/disable generating + `@return` annotations for JSDoc templates. Requires using TypeScript 4.2+ in + the workspace. default: `true` - `typescript.format.enabled`:Enable/disable format of typescript files. - `typescript.format.insertSpaceAfterCommaDelimiter` default: `true` - `typescript.format.insertSpaceAfterConstructor` default: `false` @@ -210,6 +213,9 @@ for guide of coc.nvim's configuration. - `javascript.suggest.includeCompletionsForImportStatements`: Enable/disable auto-import-style completions on partially-typed import statements. Requires using TypeScript 4.3+ in the workspace, default: `true` +- `javascript.suggest.jsdoc.generateReturns`: Enable/disable generating + `@return` annotations for JSDoc templates. Requires using TypeScript 4.2+ in + the workspace. default: `true` - `javascript.suggest.classMemberSnippets.enabled`: Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace, default: `true` diff --git a/package.json b/package.json index ea34e65..48f4487 100644 --- a/package.json +++ b/package.json @@ -396,6 +396,12 @@ "description": "Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace", "scope": "resource" }, + "typescript.suggest.jsdoc.generateReturns": { + "type": "boolean", + "default": true, + "markdownDescription": "Enable/disable generating `@return` annotations for JSDoc templates. Requires using TypeScript 4.2+ in the workspace.", + "scope": "resource" + }, "typescript.format.enabled": { "type": "boolean", "default": true, @@ -622,6 +628,12 @@ "description": "Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace", "scope": "resource" }, + "javascript.suggest.jsdoc.generateReturns": { + "type": "boolean", + "default": true, + "markdownDescription": "Enable/disable generating `@return` annotations for JSDoc templates. Requires using TypeScript 4.2+ in the workspace.", + "scope": "resource" + }, "javascript.format.enabled": { "type": "boolean", "default": true, diff --git a/src/server/features/fileConfigurationManager.ts b/src/server/features/fileConfigurationManager.ts index 7a6635d..1f39d28 100644 --- a/src/server/features/fileConfigurationManager.ts +++ b/src/server/features/fileConfigurationManager.ts @@ -41,6 +41,7 @@ export interface SuggestOptions { readonly includeCompletionsForImportStatements: boolean readonly includeCompletionsWithSnippetText: boolean readonly includeCompletionsWithClassMemberSnippets: boolean + readonly generateReturnInDocTemplate: boolean } export default class FileConfigurationManager { @@ -160,6 +161,7 @@ export default class FileConfigurationManager { paths: config.get('paths', true), completeFunctionCalls: config.get('completeFunctionCalls', true), autoImports: config.get('autoImports', true), + generateReturnInDocTemplate: config.get('jsdoc.generateReturns', true), importStatementSuggestions: config.get('importStatements', true), includeCompletionsForImportStatements: config.get('includeCompletionsForImportStatements', true), includeCompletionsWithSnippetText: config.get('includeCompletionsWithSnippetText', true), @@ -182,7 +184,10 @@ export default class FileConfigurationManager { jsxAttributeCompletionStyle: getJsxAttributeCompletionStyle(config), allowTextChangesInNewFiles: uri.startsWith('file:'), allowRenameOfImportPath: true, + // can't support it with coc.nvim by now. + provideRefactorNotApplicableReason: false, providePrefixAndSuffixTextForRename: config.get('renameShorthandProperties', true) === false ? false : config.get('useAliasesForRenames', true), + generateReturnInDocTemplate: suggestConfig.generateReturnInDocTemplate, includeCompletionsForImportStatements: suggestConfig.includeCompletionsForImportStatements, includeCompletionsWithClassMemberSnippets: suggestConfig.includeCompletionsWithClassMemberSnippets, includeCompletionsWithSnippetText: suggestConfig.includeCompletionsWithSnippetText,