diff --git a/autoload/coc/float.vim b/autoload/coc/float.vim index 83687ea13c3..cd1797cab35 100644 --- a/autoload/coc/float.vim +++ b/autoload/coc/float.vim @@ -127,6 +127,52 @@ function! coc#float#create_float_win(winid, bufnr, config) abort " happens when using getchar() #3921 return [] endtry + + " Calculate position when relative is editor + if get(a:config, 'relative', '') ==# 'editor' + let top = get(a:config, 'top', v:null) + let bottom = get(a:config, 'bottom', v:null) + let left = get(a:config, 'left', v:null) + let right = get(a:config, 'right', v:null) + + if top isnot v:null || bottom isnot v:null || left isnot v:null || right isnot v:null + let height = &lines + let width = &columns + + " Calculate row + let calc_row = a:config.row + if bottom isnot v:null + let calc_row = height - bottom - a:config.height - 2 + elseif top isnot v:null + let calc_row = top + endif + + " Calculate col + let calc_col = a:config.col + if right isnot v:null + let calc_col = width - right - a:config.width - 3 + elseif left isnot v:null + let calc_col = left + endif + + " Check if window would overlap cursor position + let pos = screenpos(0, line('.'), col('.')) + let currow = pos.row - 1 + let curcol = pos.col - 1 + let win_top = calc_row + let win_bottom = win_top + a:config.height + 2 + let win_left = calc_col + let win_right = win_left + a:config.width + 3 + + " If window would overlap cursor, switch to cursor relative + if currow >= win_top && currow <= win_bottom && curcol >= win_left && curcol <= win_right + let a:config.relative = 'cursor' + else + let a:config.row = calc_row + let a:config.col = calc_col + endif + endif + endif let lnum = max([1, get(a:config, 'index', 0) + 1]) let zindex = get(a:config, 'zindex', 50) " use exists diff --git a/autoload/coc/highlight.vim b/autoload/coc/highlight.vim index 948eb29cf90..745f2a6a9b2 100644 --- a/autoload/coc/highlight.vim +++ b/autoload/coc/highlight.vim @@ -5,7 +5,7 @@ let s:namespace_map = {} let s:ns_id = 1 let s:diagnostic_hlgroups = ['CocErrorHighlight', 'CocWarningHighlight', 'CocInfoHighlight', 'CocHintHighlight', 'CocDeprecatedHighlight', 'CocUnusedHighlight'] " Maximum count to highlight each time. -let g:coc_highlight_maximum_count = get(g:, 'coc_highlight_maximum_count', 200) +let g:coc_highlight_maximum_count = get(g:, 'coc_highlight_maximum_count', 500) let s:term = &termguicolors == 0 && !has('gui_running') " Update buffer region by region. diff --git a/autoload/coc/vtext.vim b/autoload/coc/vtext.vim index 08d7926148b..2c8d756115e 100644 --- a/autoload/coc/vtext.vim +++ b/autoload/coc/vtext.vim @@ -34,7 +34,7 @@ function! coc#vtext#add(bufnr, src_id, line, blocks, opts) abort let type = coc#api#create_type(a:src_id, hl, a:opts) let opts = extend({ 'text': text, 'type': type, 'bufnr': a:bufnr }, base) if first && !empty(indent) - let opts['text'] = indent . text + let opts['text_padding_left'] = s:calc_padding_size(indent) endif call prop_add(a:line + 1, column, opts) let first = 0 @@ -77,3 +77,19 @@ function! s:get_option_vim(align, column, wrap) abort endif return opts endfunction + +function! s:calc_padding_size(indent) abort + let tabSize = &shiftwidth + if tabSize == 0 + let tabSize = &tabstop + endif + let padding = 0 + for c in a:indent + if c == "\t" + let padding += tabSize - (padding % tabSize) + else + let padding += 1 + endif + endfor + return padding +endfunction diff --git a/build/index.js b/build/index.js index 3d5c9ad03b5..b543ddac971 100644 --- a/build/index.js +++ b/build/index.js @@ -17420,11 +17420,11 @@ var init_main = __esm({ } SymbolInformation5.create = create; })(SymbolInformation || (SymbolInformation = {})); - (function(WorkspaceSymbol5) { + (function(WorkspaceSymbol6) { function create(name2, kind, uri, range) { return range !== void 0 ? { name: name2, kind, location: { uri, range } } : { name: name2, kind, location: { uri } }; } - WorkspaceSymbol5.create = create; + WorkspaceSymbol6.create = create; })(WorkspaceSymbol || (WorkspaceSymbol = {})); (function(DocumentSymbol7) { function create(name2, detail, kind, range, selectionRange, children) { @@ -17480,7 +17480,7 @@ var init_main = __esm({ } CodeActionContext5.is = is; })(CodeActionContext || (CodeActionContext = {})); - (function(CodeAction6) { + (function(CodeAction7) { function create(title, kindOrCommandOrEdit, kind) { let result = { title }; let checkKind = true; @@ -17497,12 +17497,12 @@ var init_main = __esm({ } return result; } - CodeAction6.create = create; + CodeAction7.create = create; function is(value) { let candidate = value; return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); } - CodeAction6.is = is; + CodeAction7.is = is; })(CodeAction || (CodeAction = {})); (function(CodeLens3) { function create(range, data) { @@ -22344,13 +22344,13 @@ var require_main2 = __commonJS({ } SymbolInformation6.create = create; })(SymbolInformation5 || (exports3.SymbolInformation = SymbolInformation5 = {})); - var WorkspaceSymbol5; - (function(WorkspaceSymbol6) { + var WorkspaceSymbol6; + (function(WorkspaceSymbol7) { function create(name2, kind, uri, range) { return range !== void 0 ? { name: name2, kind, location: { uri, range } } : { name: name2, kind, location: { uri } }; } - WorkspaceSymbol6.create = create; - })(WorkspaceSymbol5 || (exports3.WorkspaceSymbol = WorkspaceSymbol5 = {})); + WorkspaceSymbol7.create = create; + })(WorkspaceSymbol6 || (exports3.WorkspaceSymbol = WorkspaceSymbol6 = {})); var DocumentSymbol7; (function(DocumentSymbol8) { function create(name2, detail, kind, range, selectionRange, children) { @@ -22409,8 +22409,8 @@ var require_main2 = __commonJS({ } CodeActionContext6.is = is; })(CodeActionContext5 || (exports3.CodeActionContext = CodeActionContext5 = {})); - var CodeAction6; - (function(CodeAction7) { + var CodeAction7; + (function(CodeAction8) { function create(title, kindOrCommandOrEdit, kind) { var result = { title }; var checkKind = true; @@ -22427,13 +22427,13 @@ var require_main2 = __commonJS({ } return result; } - CodeAction7.create = create; + CodeAction8.create = create; function is(value) { var candidate = value; return candidate && Is2.string(candidate.title) && (candidate.diagnostics === void 0 || Is2.typedArray(candidate.diagnostics, Diagnostic8.is)) && (candidate.kind === void 0 || Is2.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command3.is(candidate.command)) && (candidate.isPreferred === void 0 || Is2.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit7.is(candidate.edit)); } - CodeAction7.is = is; - })(CodeAction6 || (exports3.CodeAction = CodeAction6 = {})); + CodeAction8.is = is; + })(CodeAction7 || (exports3.CodeAction = CodeAction7 = {})); var CodeLens3; (function(CodeLens4) { function create(range, data) { @@ -36866,6 +36866,11 @@ var init_floatFactory = __esm({ if (opts.highlight) config.highlight = opts.highlight; if (opts.borderhighlight) config.borderhighlight = opts.borderhighlight; if (opts.cursorline) config.cursorline = 1; + if (opts.position) config.relative = opts.position === "fixed" ? config.relative = "editor" : "cursor"; + if (typeof opts.top === "number" && opts.top >= 0) config.top = opts.top; + if (typeof opts.left === "number" && opts.left >= 0) config.left = opts.left; + if (typeof opts.bottom === "number" && opts.bottom >= 0) config.bottom = opts.bottom; + if (typeof opts.right === "number" && opts.right >= 0) config.right = opts.right; let autoHide = opts.autoHide === false ? false : true; if (autoHide) config.autohide = 1; this.unbind(); @@ -37282,32 +37287,23 @@ var init_highlights = __esm({ } if (added.length == 0) { if (exists.length > 0) { - if (this.checkMarkers) { - removeMarkers.push(...exists.map((o) => o[4])); - } else { - linesToRemove.push(i); - } + removeMarkers.push(...exists.map((o) => o[4])); } } else { if (exists.length == 0) { newItems.push(...added.map((o) => convertHighlightItem(o))); } else { - if (this.checkMarkers) { - let skip = 0; - let min = Math.min(exists.length, added.length); - while (skip < min) { - if (isSame(added[skip], exists[skip])) { - skip++; - } else { - break; - } + let skip = 0; + let min = Math.min(exists.length, added.length); + while (skip < min) { + if (isSame(added[skip], exists[skip])) { + skip++; + } else { + break; } - removeMarkers.push(...exists.slice(skip).map((o) => o[4])); - newItems.push(...added.slice(skip).map((o) => convertHighlightItem(o))); - } else if (added.length != exists.length || !added.every((o, i2) => isSame(o, exists[i2]))) { - linesToRemove.push(i); - newItems.push(...added.map((o) => convertHighlightItem(o))); } + removeMarkers.push(...exists.slice(skip).map((o) => o[4])); + newItems.push(...added.slice(skip).map((o) => convertHighlightItem(o))); } } } @@ -37824,6 +37820,28 @@ var init_schema = __esm({ minimum: 0, maximum: 100, description: "Enables pseudo-transparency by set 'winblend' option of window, neovim only." + }, + position: { + type: "string", + default: "auto", + description: "Controls how floating windows are positioned. When set to `'fixed'`, the window will be positioned according to the `top`, `bottom`, `left`, and `right` settings. When set to `'auto'`, the window follows the default position.", + enum: ["fixed", "auto"] + }, + top: { + type: "number", + description: "Distance from the top of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `bottom` is set." + }, + bottom: { + type: "number", + description: "Distance from the bottom of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `top` if both are set." + }, + left: { + type: "number", + description: "Distance from the left edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `right` is set." + }, + right: { + type: "number", + description: "Distance from the right edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `left` if both are set." } } }, @@ -38734,7 +38752,12 @@ var init_schema = __esm({ maxWidth: {}, winblend: {}, focusable: {}, - shadow: {} + shadow: {}, + position: {}, + top: {}, + bottom: {}, + left: {}, + right: {} } }, "diagnostic.format": { @@ -39006,7 +39029,12 @@ var init_schema = __esm({ maxHeight: {}, winblend: {}, focusable: {}, - shadow: {} + shadow: {}, + position: {}, + top: {}, + bottom: {}, + left: {}, + right: {} } }, "hover.autoHide": { @@ -39032,7 +39060,12 @@ var init_schema = __esm({ maxWidth: {}, winblend: {}, focusable: {}, - shadow: {} + shadow: {}, + position: {}, + top: {}, + bottom: {}, + left: {}, + right: {} } }, "hover.previewMaxHeight": { @@ -39625,7 +39658,12 @@ var init_schema = __esm({ maxWidth: {}, winblend: {}, focusable: {}, - shadow: {} + shadow: {}, + position: {}, + top: {}, + bottom: {}, + left: {}, + right: {} } }, "signature.hideOnTextChange": { @@ -49354,8 +49392,7 @@ var init_window = __esm({ get: () => this.workspace.statusLine }); } - init(env) { - this.highlights.checkMarkers = this.workspace.has("nvim-0.5.1") || env.isVim; + init(_env) { } get activeTextEditor() { return this.workspace.editors.activeTextEditor; @@ -67070,7 +67107,7 @@ var init_prompt = __esm({ Prompt = class { constructor(nvim) { this.nvim = nvim; - this.cusorIndex = 0; + this.cursorIndex = 0; this._input = ""; this._mode = "insert"; this.interactive = false; @@ -67083,7 +67120,7 @@ var init_prompt = __esm({ } set input(str) { if (this._input == str) return; - this.cusorIndex = str.length; + this.cursorIndex = str.length; this._input = str; this.drawPrompt(); this._onDidChangeInput.fire(this._input); @@ -67103,7 +67140,7 @@ var init_prompt = __esm({ start(opts) { if (opts) { this.interactive = opts.interactive; - this.cusorIndex = opts.input.length; + this.cursorIndex = opts.input.length; this._input = opts.input; this._mode = opts.mode; this._matcher = opts.interactive ? "" : opts.matcher; @@ -67117,11 +67154,11 @@ var init_prompt = __esm({ } reset() { this._input = ""; - this.cusorIndex = 0; + this.cursorIndex = 0; } drawPrompt() { let indicator = configuration_default.get("indicator", ">"); - let { cusorIndex, interactive, input, _matcher } = this; + let { cursorIndex, interactive, input, _matcher } = this; let cmds = ['echo ""']; if (this.mode == "insert") { if (interactive) { @@ -67130,14 +67167,14 @@ var init_prompt = __esm({ cmds.push(`echohl MoreMsg | echon '${_matcher.toUpperCase()} ' | echohl None`); } cmds.push(`echohl Special | echon '${indicator} ' | echohl None`); - if (cusorIndex == input.length) { + if (cursorIndex == input.length) { cmds.push(`echon '${input.replace(/'/g, "''")}'`); cmds.push(`echohl Cursor | echon ' ' | echohl None`); } else { - let pre = input.slice(0, cusorIndex); + let pre = input.slice(0, cursorIndex); if (pre) cmds.push(`echon '${pre.replace(/'/g, "''")}'`); - cmds.push(`echohl Cursor | echon '${input[cusorIndex].replace(/'/, "''")}' | echohl None`); - let post = input.slice(cusorIndex + 1); + cmds.push(`echohl Cursor | echon '${input[cursorIndex].replace(/'/, "''")}' | echohl None`); + let post = input.slice(cursorIndex + 1); cmds.push(`echon '${post.replace(/'/g, "''")}'`); } } else { @@ -67148,86 +67185,86 @@ var init_prompt = __esm({ this.nvim.command(cmd, true); } moveLeft() { - if (this.cusorIndex == 0) return; - this.cusorIndex = this.cusorIndex - 1; + if (this.cursorIndex == 0) return; + this.cursorIndex = this.cursorIndex - 1; this.drawPrompt(); } moveRight() { - if (this.cusorIndex == this._input.length) return; - this.cusorIndex = this.cusorIndex + 1; + if (this.cursorIndex == this._input.length) return; + this.cursorIndex = this.cursorIndex + 1; this.drawPrompt(); } moveLeftWord() { - let { cusorIndex, input } = this; - if (cusorIndex == 0) return; - let pre = input.slice(0, cusorIndex); + let { cursorIndex, input } = this; + if (cursorIndex == 0) return; + let pre = input.slice(0, cursorIndex); let remain = getLastWordRemovedText(pre); - this.cusorIndex = cusorIndex - (pre.length - remain.length); + this.cursorIndex = cursorIndex - (pre.length - remain.length); this.drawPrompt(); this._onDidChangeInput.fire(this._input); } moveRightWord() { - let { cusorIndex, input } = this; - if (cusorIndex == input.length) return; - let post = input.slice(cusorIndex); + let { cursorIndex, input } = this; + if (cursorIndex == input.length) return; + let post = input.slice(cursorIndex); let nextWord = post.match(/[\w$]+ */).at(0) ?? post; - this.cusorIndex = cusorIndex + nextWord.length; + this.cursorIndex = cursorIndex + nextWord.length; this.drawPrompt(); this._onDidChangeInput.fire(this._input); } moveToEnd() { - if (this.cusorIndex == this._input.length) return; - this.cusorIndex = this._input.length; + if (this.cursorIndex == this._input.length) return; + this.cursorIndex = this._input.length; this.drawPrompt(); } moveToStart() { - if (this.cusorIndex == 0) return; - this.cusorIndex = 0; + if (this.cursorIndex == 0) return; + this.cursorIndex = 0; this.drawPrompt(); } onBackspace() { - let { cusorIndex, input } = this; - if (cusorIndex == 0) return; - let pre = input.slice(0, cusorIndex); - let post = input.slice(cusorIndex); - this.cusorIndex = cusorIndex - 1; + let { cursorIndex, input } = this; + if (cursorIndex == 0) return; + let pre = input.slice(0, cursorIndex); + let post = input.slice(cursorIndex); + this.cursorIndex = cursorIndex - 1; this._input = `${pre.slice(0, pre.length - 1)}${post}`; this.drawPrompt(); this._onDidChangeInput.fire(this._input); } removeNext() { - let { cusorIndex, input } = this; - if (cusorIndex == input.length) return; - let pre = input.slice(0, cusorIndex); - let post = input.slice(cusorIndex + 1); + let { cursorIndex, input } = this; + if (cursorIndex == input.length) return; + let pre = input.slice(0, cursorIndex); + let post = input.slice(cursorIndex + 1); this._input = `${pre}${post}`; this.drawPrompt(); this._onDidChangeInput.fire(this._input); } removeWord() { - let { cusorIndex, input } = this; - if (cusorIndex == 0) return; - let pre = input.slice(0, cusorIndex); - let post = input.slice(cusorIndex); + let { cursorIndex, input } = this; + if (cursorIndex == 0) return; + let pre = input.slice(0, cursorIndex); + let post = input.slice(cursorIndex); let remain = getLastWordRemovedText(pre); - this.cusorIndex = cusorIndex - (pre.length - remain.length); + this.cursorIndex = cursorIndex - (pre.length - remain.length); this._input = `${remain}${post}`; this.drawPrompt(); this._onDidChangeInput.fire(this._input); } removeTail() { - let { cusorIndex, input } = this; - if (cusorIndex == input.length) return; - let pre = input.slice(0, cusorIndex); + let { cursorIndex, input } = this; + if (cursorIndex == input.length) return; + let pre = input.slice(0, cursorIndex); this._input = pre; this.drawPrompt(); this._onDidChangeInput.fire(this._input); } removeAhead() { - let { cusorIndex, input } = this; - if (cusorIndex == 0) return; - let post = input.slice(cusorIndex); - this.cusorIndex = 0; + let { cursorIndex, input } = this; + if (cursorIndex == 0) return; + let post = input.slice(cursorIndex); + this.cursorIndex = 0; this._input = post; this.drawPrompt(); this._onDidChangeInput.fire(this._input); @@ -67259,10 +67296,10 @@ var init_prompt = __esm({ this.addText(text); } addText(text) { - let { cusorIndex, input } = this; - this.cusorIndex = cusorIndex + text.length; - let pre = input.slice(0, cusorIndex); - let post = input.slice(cusorIndex); + let { cursorIndex, input } = this; + this.cursorIndex = cursorIndex + text.length; + let pre = input.slice(0, cursorIndex); + let post = input.slice(cursorIndex); this._input = `${pre}${text}${post}`; this.drawPrompt(); this._onDidChangeInput.fire(this._input); @@ -75217,6 +75254,7 @@ var init_language_client = __esm({ let options2 = Object.assign({}, command.options); options2.env = options2.env ? Object.assign({}, process.env, options2.env) : process.env; options2.cwd = options2.cwd || serverWorkingDir; + options2.shell = process.platform === "win32" || !!options2.shell; let cmd = workspace_default.expand(json.command); let serverProcess = child_process.spawn(cmd, args, options2); serverProcess.on("error", (e) => { @@ -81774,7 +81812,7 @@ var init_complete = __esm({ let { insertMode } = this.config; let { linenr, followWord, position } = this.option; let line = linenr - 1; - let end = position.character + (insertMode == "replace" /* Repalce */ ? followWord.length : 0); + let end = position.character + (insertMode == "replace" /* Replace */ ? followWord.length : 0); return Range.create(line, this.inputStart, line, end); } createTokenSource(isIncomplete) { @@ -82346,7 +82384,7 @@ var init_completion2 = __esm({ let suggest = workspace_default.getConfiguration("suggest", doc); this.config = { autoTrigger: suggest.get("autoTrigger", "always"), - insertMode: suggest.get("insertMode", "replace" /* Repalce */), + insertMode: suggest.get("insertMode", "replace" /* Replace */), filterGraceful: suggest.get("filterGraceful", true), enableFloat: suggest.get("enableFloat", true), languageSourcePriority: suggest.get("languageSourcePriority", 99), @@ -87465,9 +87503,8 @@ var init_buffer6 = __esm({ if (token.isCancellationRequested || spans.length === 0) return; let height = workspace_default.env.lines; spans.forEach((o) => { - let s = o[0]; - o[0] = Math.max(0, Math.floor(s - height * 1.5)); - o[1] = Math.min(lineCount, Math.ceil(o[1] + height * 1.5), s + height * 2); + o[0] = Math.max(0, Math.floor(o[0] - height)); + o[1] = Math.min(lineCount, Math.ceil(o[1] + height)); }); for (let [start, end] of Regions.mergeSpans(spans)) { if (!skipCheck && regions.has(start, end)) continue; @@ -89249,8 +89286,8 @@ var init_workspace2 = __esm({ global: workspace_default.workspaceFolderControl.getRootPatterns(doc, 2 /* Global */) }; } - async ensureDocument() { - let doc = await workspace_default.document; + async ensureDocument(bufnr) { + let doc = bufnr ? workspace_default.getDocument(bufnr) : await workspace_default.document; return doc && doc.attached; } async doKeymap(key, defaultReturn = "") { @@ -89269,7 +89306,7 @@ var init_workspace2 = __esm({ } async showInfo() { let lines = []; - let version2 = workspace_default.version + (true ? "-aacbbcad 2024-11-23 13:34:02 +0800" : ""); + let version2 = workspace_default.version + (true ? "-a6e54aed 2024-12-18 12:26:34 +0800" : ""); lines.push("## versions"); lines.push(""); let out = await this.nvim.call("execute", ["version"]); @@ -89591,7 +89628,7 @@ var init_plugin = __esm({ void window_default.showInformationMessage(`Run :CocInstall coc-json for json intellisense`); }); this.addAction("rootPatterns", (bufnr) => this.handler.workspace.getRootPatterns(bufnr)); - this.addAction("ensureDocument", () => this.handler.workspace.ensureDocument()); + this.addAction("ensureDocument", (bufnr) => this.handler.workspace.ensureDocument(bufnr)); this.addAction("addWorkspaceFolder", (folder) => this.handler.workspace.addWorkspaceFolder(folder)); this.addAction("removeWorkspaceFolder", (folder) => this.handler.workspace.removeWorkspaceFolder(folder)); this.addAction("getConfig", (key) => this.handler.workspace.getConfiguration(key)); @@ -89764,7 +89801,7 @@ var init_plugin = __esm({ } async cocAction(method, ...args) { let fn = this.actions.get(method); - if (!fn) throw new Error(`Action "${method}" not exist`); + if (!fn) throw new Error(`Action "${method}" does not exist`); return await Promise.resolve(fn.apply(null, args)); } getHandler() { diff --git a/doc/coc-api.txt b/doc/coc-api.txt index 588d0fb4452..d4357962698 100644 --- a/doc/coc-api.txt +++ b/doc/coc-api.txt @@ -391,7 +391,7 @@ correct source map support for the error stack. • Find out the npm root by `npm root -g` • Load source-map-support with coc.nvim by append arguments to node in vimrc: `let g:coc_node_args = ['-r', '/path/to/npm/root/source-map-support/register']` - Repalce the part `/path/to/npm/root` with result from `npm root -g` terminal + Replace the part `/path/to/npm/root` with result from `npm root -g` terminal command. Note: the source-map-support module slows down the coc.nvim initialization. diff --git a/doc/coc-config.txt b/doc/coc-config.txt index ef1118af1b8..5fa26bc8b19 100644 --- a/doc/coc-config.txt +++ b/doc/coc-config.txt @@ -1723,6 +1723,11 @@ supported: `0`. - "focusable": Set to false to make window not focusable, neovim only. - "shadow": Set to true to enable shadow, neovim only. + - "position": Controls how floating windows are positioned. When set to `'fixed'`, the window will be positioned according to the `top`, `bottom`, `left`, and `right` settings. When set to `'auto'`, the window follows the default position. + - "top": Distance from the top of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `bottom` is set. + - "bottom": Distance from the bottom of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `top` if both are set. + - "left": Distance from the left edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Will be ignored if `right` is set. + - "right": "Distance from the right edge of the editor window in characters. Only takes effect when `position` is set to `'fixed'`. Takes precedence over `left` if both are set." ------------------------------------------------------------------------------ Languageserver~ diff --git a/doc/coc-example-config.lua b/doc/coc-example-config.lua index 7cb96f3f526..89f85fabe19 100644 --- a/doc/coc-example-config.lua +++ b/doc/coc-example-config.lua @@ -1,4 +1,4 @@ --- https://raw.githubusercontent.com/neoclide/coc.nvim/master/coc-example-config.lua +-- https://raw.githubusercontent.com/neoclide/coc.nvim/refs/heads/master/doc/coc-example-config.lua -- Some servers have issues with backup files, see #649 vim.opt.backup = false diff --git a/doc/coc-example-config.vim b/doc/coc-example-config.vim index eeb76c847f5..af90aec4b16 100644 --- a/doc/coc-example-config.vim +++ b/doc/coc-example-config.vim @@ -1,4 +1,4 @@ -" https://raw.githubusercontent.com/neoclide/coc.nvim/master/coc-example.vim +" https://raw.githubusercontent.com/neoclide/coc.nvim/refs/heads/master/doc/coc-example-config.vim " May need for Vim (not Neovim) since coc.nvim calculates byte offset by count " utf-8 byte sequence diff --git a/doc/coc.txt b/doc/coc.txt index f6c22b9d36d..b50459db0b5 100644 --- a/doc/coc.txt +++ b/doc/coc.txt @@ -124,7 +124,7 @@ And run: > For other plugin managers, make sure to use the release branch (unless you need to build from typescript source code). -To use Vim's native |packages| on Linux or MaxOS, use script like: > +To use Vim's native |packages| on Linux or macOS, use script like: > #!/bin/sh # for vim8 @@ -1877,7 +1877,7 @@ g:coc_highlight_maximum_count *g:coc_highlight_maximum_count* When highlight items exceed maximum count, highlight items will be grouped and added by using |timer_start| for better user experience. - Default `200` + Default `500` g:coc_default_semantic_highlight_groups *g:coc_default_semantic_highlight_groups* @@ -2448,9 +2448,9 @@ Acceptable {action} names for |CocAction()| and |CocActionAsync()|. Add {folder} to workspace folders, {folder} should be exists directory on file system. -"ensureDocument" *CocAction('ensureDocument')* +"ensureDocument" [{bufnr}] *CocAction('ensureDocument')* - Ensure current document is attached to coc.nvim + Ensure current or specified document is attached to coc.nvim |coc-document-attached|, should be used when you need invoke action of current document on buffer create. diff --git a/history.md b/history.md index e27a4f857e9..d1f235be593 100644 --- a/history.md +++ b/history.md @@ -1,3 +1,13 @@ +# 2024-12-10 + +- Floating window can be set to fixed position, try `diagnostic.floatConfig` +- `ensureDocument` and `hasProvider` support to accept specified bufnr + +# 2024-11-29 + +- Increase `g:coc_highlight_maximum_count` default to 500 for better performance. +- Add `uriConverter.code2Protocol` for extensions + # 2024-10-25 - Mention [davidosomething/coc-diagnostics-shim.nvim](https://github.com/davidosomething/coc-diagnostics-shim.nvim) as alternative to ALE for diagnostics display.