From 65574c5b47858378082439206e24b8893d89da59 Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Thu, 20 Feb 2025 14:14:12 +0800 Subject: [PATCH 1/3] fix(diagnostic): correct display configurations (#5262) --- src/diagnostic/buffer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagnostic/buffer.ts b/src/diagnostic/buffer.ts index be4964f048a..29337bffe38 100644 --- a/src/diagnostic/buffer.ts +++ b/src/diagnostic/buffer.ts @@ -293,7 +293,7 @@ export class DiagnosticBuffer implements SyncItem { */ public async echoMessage(truncate = false, position: Position, target?: string): Promise { const config = this.config - if (!config.enable || config.enableMessage === 'never' || config.displayByAle || config.displayByVimDiagnostic) return false + if (!config.enable || config.enableMessage === 'never' || this.displayByAle || this.displayByVimDiagnostic) return false if (!target) target = config.messageTarget let useFloat = target == 'float' let diagnostics = this.getDiagnosticsAtPosition(position) From 61e65da7cc1f59a943cadf1da9d8662b2ad49b13 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Thu, 20 Feb 2025 15:07:14 +0800 Subject: [PATCH 2/3] chore(doc): remove doc for vim & nvim which not supported --- autoload/coc/float.vim | 3 --- data/schema.json | 4 ++-- doc/coc-config.txt | 7 +++---- doc/coc.txt | 24 +++++++----------------- src/neovim/api/Buffer.ts | 2 +- typings/index.d.ts | 16 ++++++++-------- 6 files changed, 21 insertions(+), 35 deletions(-) diff --git a/autoload/coc/float.vim b/autoload/coc/float.vim index cd1797cab35..2e060284a35 100644 --- a/autoload/coc/float.vim +++ b/autoload/coc/float.vim @@ -687,9 +687,6 @@ function! coc#float#has_scroll() abort endfunction function! coc#float#scroll(forward, ...) - if !has('nvim-0.4.0') && !has('patch-8.2.0750') - throw 'coc#float#scroll() requires nvim >= 0.4.0 or vim >= 8.2.0750' - endif let amount = get(a:, 1, 0) let winids = filter(coc#float#get_float_win_list(), 'coc#float#scrollable(v:val) && getwinvar(v:val,"kind","") !=# "pum"') if empty(winids) diff --git a/data/schema.json b/data/schema.json index e1fe8702091..1228302c3ae 100644 --- a/data/schema.json +++ b/data/schema.json @@ -1112,7 +1112,7 @@ "diagnostic.virtualText": { "type": "boolean", "scope": "language-overridable", - "description": "Use virtual text to display diagnostics, requires neovim >= 0.5.0 or vim >= 9.0.0067.", + "description": "Use virtual text to display diagnostics.", "default": false }, "diagnostic.virtualTextAlign": { @@ -2262,7 +2262,7 @@ "suggest.virtualText": { "type": "boolean", "scope": "application", - "description": "Show virtual text for insert word of selected item, requires neovim >= 0.5.0 or vim >= 9.0.0067", + "description": "Show virtual text for insert word of selected item", "default": false }, "tree.closedIcon": { diff --git a/doc/coc-config.txt b/doc/coc-config.txt index 5fa26bc8b19..5fa143f4ff2 100644 --- a/doc/coc-config.txt +++ b/doc/coc-config.txt @@ -306,8 +306,7 @@ Diagnostic~ "diagnostic.virtualText" *coc-config-diagnostic-virtualText* - Use virtual text to display diagnostics, requires neovim >= 0.5.0 or - vim >= 9.0.0067. + Use virtual text to display diagnostics. Scope: `language-overridable`, default: `false` @@ -1386,8 +1385,8 @@ Suggest~ "suggest.virtualText" *coc-config-suggest-virtualText* - Show virtual text for insert word of selected item, requires - neovim >= 0.5.0 or vim >= 9.0.0067. + Show virtual text after cursor for insert word of current selected + complete item. Scope: `application`, default: `false` diff --git a/doc/coc.txt b/doc/coc.txt index 2679ec644da..b11afd2db9a 100644 --- a/doc/coc.txt +++ b/doc/coc.txt @@ -105,7 +105,7 @@ automatic completion of coc.nvim by use `"suggest.autoTrigger": "none"` (or ============================================================================== REQUIREMENTS *coc-requirements* -Neovim >= 0.4.0 or Vim >= 8.1.1719. +Neovim >= 0.8.0 or Vim >= 9.0.0483. NodeJS https://nodejs.org/ >= 16.18.0. @@ -1002,8 +1002,6 @@ DOCUMENT COLORS *coc-document-colors* Document colors added color highlights to vim buffers. To enable document color highlights, use |coc-config-colors-enable|. -The feature requires vim >= 8.1.1719 or neovim >= 0.5.0. - Note: the highlights define gui colors only, make use you have 'termguicolors' enabled (and your terminal support gui colors) if you're using vim in terminal. @@ -1304,8 +1302,6 @@ SEMANTIC HIGHLIGHTS *coc-semantic-highlights* Semantic tokens are used to add additional color information to a buffer that depends on language specific symbol information. -The feature requires vim >= 8.1.1719 or neovim >= 0.5.0. - Use |coc-config-semanticTokens-enable| to enable semantic tokens highlights. Use `:CocCommand semanticTokens.checkCurrent` to check semantic highlight @@ -2316,14 +2312,12 @@ coc#float#has_scroll() *coc#float#has_scroll()* Example key-mappings: > - if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - endif + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" < coc#float#scroll({forward}, [{amount}]) *coc#float#scroll()* @@ -2331,8 +2325,6 @@ coc#float#scroll({forward}, [{amount}]) *coc#float#scroll()* {forward} is not `1`. {amount} could be number or full page when omitted. Popup menu is excluded. - Note: this function requires nvim >= 0.4.0 or vim >= 8.2.750 to work. - CocRequest({id}, {method}, [{params}]) *CocRequest()* @@ -3939,8 +3931,6 @@ Note bottom buttons work different on neovim and vim, on neovim you can click the button since neovim allows focus of window, on vim you have to type highlighted character to trigger button callback. -Note dialog feature requires neovim >= 0.4.0 or vim >= 8.2.0750 to work. - See |coc-config-dialog| for available configurations. -------------------------------------------------------------------------------- diff --git a/src/neovim/api/Buffer.ts b/src/neovim/api/Buffer.ts index d11667222f9..78fe245105a 100644 --- a/src/neovim/api/Buffer.ts +++ b/src/neovim/api/Buffer.ts @@ -240,7 +240,7 @@ export class Buffer extends BaseApi { } /** - * Set virtual text for a line, works on nvim >= 0.5.0 and vim9 + * Set virtual text for a line. * @public * @param {number} src_id - Source group to use or 0 to use a new group, or -1 * @param {number} line - Line to annotate with virtual text (zero-indexed) diff --git a/typings/index.d.ts b/typings/index.d.ts index 4f4f21c7c84..23bfba88a09 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -8269,7 +8269,7 @@ declare module 'coc.nvim' { */ readonly runtimepath: string /** - * |virtualText| support in (neo)vim, needs nvim >= 0.5.0 or vim >= 9.0067 + * |virtualText| support in (neo)vim */ readonly virtualText: boolean /** @@ -8329,7 +8329,7 @@ declare module 'coc.nvim' { */ readonly isiTerm: boolean /** - * version of (neo)vim, on vim it's like: 8020750, on neoivm it's like: 0.5.0 + * version of (neo)vim, on vim it's like: 8020750, on neoivm it's like */ readonly version: string /** @@ -8337,7 +8337,7 @@ declare module 'coc.nvim' { */ readonly progpath: string /** - * Is true when dialog feature is supported, which need vim >= 8.2.750 or neovim >= 0.4.0 + * Is true when dialog feature is supported */ readonly dialog: boolean /** @@ -9829,11 +9829,11 @@ declare module 'coc.nvim' { cursorline?: boolean modes?: string[] excludeImages?: boolean - position?: "fixed" | "auto"; - top?: number; - bottom?: number; - left?: number; - right?: number; + position?: "fixed" | "auto" + top?: number + bottom?: number + left?: number + right?: number } export interface FloatFactory { From a7e1ceb20a975527941257b448188cfcf4449156 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Thu, 20 Feb 2025 15:52:28 +0800 Subject: [PATCH 3/3] chore(extension): fix typo --- doc/coc.txt | 3 +++ src/__tests__/modules/extensions.test.ts | 12 ++++++------ src/extension/index.ts | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/coc.txt b/doc/coc.txt index b11afd2db9a..b18677049a7 100644 --- a/doc/coc.txt +++ b/doc/coc.txt @@ -109,6 +109,9 @@ Neovim >= 0.8.0 or Vim >= 9.0.0483. NodeJS https://nodejs.org/ >= 16.18.0. +For neovim user, use command |:checkhealth| to check issue with current +environment. + ============================================================================== INSTALLATION *coc-installation* diff --git a/src/__tests__/modules/extensions.test.ts b/src/__tests__/modules/extensions.test.ts index ceece607fbc..6133daa79e4 100644 --- a/src/__tests__/modules/extensions.test.ts +++ b/src/__tests__/modules/extensions.test.ts @@ -38,7 +38,7 @@ describe('extensions', () => { expect(extensions.onDidActiveExtension).toBeDefined() expect(extensions.onDidUnloadExtension).toBeDefined() expect(extensions.schemes).toBeDefined() - expect(extensions.creteInstaller('npm', 'id')).toBeDefined() + expect(extensions.createInstaller('npm', 'id')).toBeDefined() }) it('should not throw with addSchemeProperty', async () => { @@ -162,7 +162,7 @@ describe('extensions', () => { }) it('should catch error when installExtensions', async () => { - let spy = jest.spyOn(extensions, 'creteInstaller').mockImplementation(() => { + let spy = jest.spyOn(extensions, 'createInstaller').mockImplementation(() => { return { on: (_key, cb) => { cb('msg', false) @@ -184,7 +184,7 @@ describe('extensions', () => { let spy = jest.spyOn(extensions, 'globalExtensionStats').mockImplementation(() => { return [{ id: 'test' }] as any }) - let s = jest.spyOn(extensions, 'creteInstaller').mockImplementation(() => { + let s = jest.spyOn(extensions, 'createInstaller').mockImplementation(() => { return { on: () => {}, update: () => { @@ -201,7 +201,7 @@ describe('extensions', () => { let spy = jest.spyOn(extensions, 'globalExtensionStats').mockImplementation(() => { return [{ id: 'test' }, { id: 'global', isLocked: true }, { id: 'disabled', state: 'disabled' }] as any }) - let s = jest.spyOn(extensions, 'creteInstaller').mockImplementation(() => { + let s = jest.spyOn(extensions, 'createInstaller').mockImplementation(() => { return { on: (_key, cb) => { cb('msg', false) @@ -222,7 +222,7 @@ describe('extensions', () => { return [{ id: 'test', exotic: true, uri: 'http://example.com' }] as any }) let called = false - let s = jest.spyOn(extensions, 'creteInstaller').mockImplementation(() => { + let s = jest.spyOn(extensions, 'createInstaller').mockImplementation(() => { return { on: (_key, cb) => { cb('msg', false) @@ -262,7 +262,7 @@ describe('extensions', () => { it('should install global extension', async () => { expect(extensions.getExtensionById('coc-omni')).toBeUndefined() let folder = path.join(extensions.modulesFolder, 'coc-omni') - let spy = jest.spyOn(extensions, 'creteInstaller').mockImplementation(() => { + let spy = jest.spyOn(extensions, 'createInstaller').mockImplementation(() => { return { on: () => {}, install: async () => { diff --git a/src/extension/index.ts b/src/extension/index.ts index 4ca1ce0d2d6..f1cfa0721eb 100644 --- a/src/extension/index.ts +++ b/src/extension/index.ts @@ -172,7 +172,7 @@ export class Extensions { return silent ? new InstallChannel(isUpdate, this.outputChannel) : new InstallBuffer(isUpdate) } - public creteInstaller(npm: string, def: string): IInstaller { + public createInstaller(npm: string, def: string): IInstaller { return new Installer(this.modulesFolder, npm, def) } @@ -188,7 +188,7 @@ export class Extensions { let fn = async (key: string): Promise => { try { installBuffer.startProgress(key) - let installer = this.creteInstaller(npm, key) + let installer = this.createInstaller(npm, key) installer.on('message', (msg, isProgress) => { installBuffer.addMessage(key, msg, isProgress) }) @@ -231,7 +231,7 @@ export class Extensions { try { installBuffer.startProgress(id) let url = stat.exotic ? stat.uri : null - let installer = this.creteInstaller(npm, id) + let installer = this.createInstaller(npm, id) installer.on('message', (msg, isProgress) => { installBuffer.addMessage(id, msg, isProgress) })