Skip to content

Commit

Permalink
perf(highlight): increase number of highlights (#5208)
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward authored Nov 27, 2024
1 parent 2fc3f0d commit 829a106
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autoload/coc/highlight.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions doc/coc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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*

Expand Down
4 changes: 2 additions & 2 deletions src/handler/semanticTokens/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ export default class SemanticTokensBuffer implements SyncItem {
if (token.isCancellationRequested || spans.length === 0) return
let height = workspace.env.lines
spans.forEach(o => {
o[0] = Math.max(0, Math.floor(o[0] - height / 2))
o[1] = Math.min(lineCount, Math.ceil(o[1] + 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
Expand Down

0 comments on commit 829a106

Please sign in to comment.