Giter Club home page Giter Club logo

coc-highlight's Introduction

Neoclide

Neoclide is a rework of Nyaovim, the reason is I want it have best user experience.

Neoclide is an editor built with web technologies while emebed with neovim.

Neoclide is in early development, which means it could break easily, and you should not take it seriously.

Since I use Mac only, something could break on other platform, I need your help!

What have done

  • Global session save and restore
  • Fixed copy/paste behaviour
  • Fixed drag and click position calculate
  • Fixed trigger of VimLeave event
  • Background transparent support
  • Improved input method support
  • Improved cursor support
  • Accessable editor state object
  • Automatic resize handler, no screen blink

How to use

Since it's in early age, no prebuild currently avaiable, you have to use it from souce code.

  • Clone this repository

  • Run following commands to install dependencies and build code

    npm run dep
    npm run build
    
  • To start the app, use:

    npm run app
    

LICENSE

Copyright 2016 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

coc-highlight's People

Contributors

azemetre avatar chemzqm avatar corbinhesse avatar dependabot[bot] avatar fnune avatar ingomeyer441 avatar varal7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coc-highlight's Issues

Option to respect highlighted search over coc-highlight

I'm looking for a way for coc-highlight to respect search highlights with something like the following:

autocmd CursorHold * silent call HighlightCursorWord()
autocmd CursorMoved * silent call ValidateHighlight()

function! HighlightCursorWord()
  let search = getreg('/')
  let cword = expand('<cword>')
  if match(cword, search) == -1
    call CocActionAsync('highlight')
  endif
endfunction

function! ValidateHighlight()
  let search = getreg('/')
  let cword = expand('<cword>')
  if match(cword, search) == 0
    call CocActionAsync('clearHighlight')
  endif
endfunction

There's currently no coc-action to do something like clearHighlight so this doesn't work. Is there a better way to do this?

I've attached a video of what the problem looks like where the search highlight does not kick in until after you move off the word:

Screen Recording 2019-04-02 at 12 27 30 AM

Wrong parsing for vim functions

I've a vim function which is test#indent#add (I particularly used this as: function('test#indent#add', [])) and here #add gets recognized as a color, which makes sense, but I do think the regex patterns should have use look-around to check if there are no alpha-characters before the #. I still want color highlighting in Vim Script, so I don't want to exclude it.

Screenshot 2019-08-02 at 08 40 15

Error: Unable to parse color from string: RGB(255, 0, 0)

Create a text file containing:

RGB(255, 0, 0)

Close and reopen the text file. coc-highlight will throw an error:

[coc.nvim] Error output from highlight: Error: Unable to parse color from string: RGB(255, 0, 0)
    at new Color (node_modules/color/index.js:53:10)
    at findColors (extensions/node_modules/coc-highlight/lib/server/matchers.js:37:23)
    at Object.findColorFunctions (extensions/node_modules/coc-highlight/lib/server/matchers.js:23:12)
    at Object.parseDocumentColors (extensions/node_modules/coc-highlight/lib/server/colors.js:13:28)
    at Document._update (extensions/node_modules/coc-highlight/lib/server/document.js:63:33)
    at new Document (extensions/node_modules/coc-highlight/lib/server/document.js:22:14)
    at Object.<anonymous> (extensions/node_modules/coc-highlight/lib/server/index.js:69:15)
    at Generator.next (<anonymous>)
    at fulfilled (node_modules/tslib/tslib.js:104:62)

:call CocAction('colorPresentation') will cause stuck in vim

Version info

OS: Darwin wenzhen.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64

Node:

$ node --version
v21.6.1

Vim:

$ vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 23 2024 22:19:02)
macOS version - arm64
Included patches: 1-50
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             +sound             -xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/opt/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: clang -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=14.2 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin -lpython3.12 -framework CoreFoundation -lruby.3.3 -L/opt/homebrew/Cellar/ruby/3.3.0/lib 

CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9010050
node version: v21.6.1
coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800
coc.nvim directory: /Users/sainnhe/.local/share/nvimplugins/coc.nvim
term: tmux
platform: darwin

## Log of coc.nvim

2024-02-02T13:58:05.610 INFO (pid:17182) [extension:coc-git] - Looking for git in: git
2024-02-02T13:58:05.673 WARN (pid:17182) [workspace] - Extension "coc-lists" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.747 WARN (pid:17182) [workspace] - Extension "coc-project" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.810 INFO (pid:17182) [plugin] - coc.nvim initialized with node: v21.6.1 after 353
2024-02-02T13:58:05.812 WARN (pid:17182) [workspace] - Extension "coc-imselect" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.823 INFO (pid:17182) [language-client-index] - Language server "css" started with 17215
2024-02-02T13:58:06.020 INFO (pid:17182) [attach] - receive notification: runCommand [ 'git.refresh' ]
2024-02-02T13:58:06.022 INFO (pid:17182) [attach] - receive notification: doAutocmd [ 12 ]
2024-02-02T13:58:07.994 INFO (pid:17182) [attach] - receive notification: showInfo []
2024-02-02T13:58:07.996 INFO (pid:17182) [attach] - receive notification: doAutocmd [ 1 ]

Steps to reproduce

  1. Install coc-highlight and coc-css
  2. Use vim to open a file named test.css
  3. Append the following content
a {
    color: #f78681;
}
  1. Move cursor over #f78681 and execute :call CocAction('colorPresentation')
  2. The vim process get stucked.

Additional information

This bug doesn't exist in neovim.

Freeze when `:call CocAction('colorPresentation')` is executed.

I put the cursor over a color code (rgb) and then ran the command. The popup will show up eventually, but not after freezing for a minute or so. Coc.nvim is up-to-date.

From profile.log:

FUNCTIONS SORTED ON TOTAL TIME
count  | total (s) |  self (s) | function
    2  | 60.065162  |  0.000086  | coc#rpc#request()
    2  | 60.065025  | 60.063749 |  <SNR>30_request()
    1  | 60.064558  | 0.000034  | CocAction()

========================================
FUNCTION  coc#rpc#request()
    Defined: ~/.vim/plugged/coc.nvim/autoload/coc/rpc.vim:88
Called 2 times
Total time:  60.065162
 Self time:   0.000086

count  total (s)   self (s)
    2   0.000075   0.000024   if !coc#rpc#ready()
                                return ''
    2              0.000003   endif
    2  60.065076   0.000051   return s:client['request'](a:method, a:args)
=========================================
FUNCTION  <SNR>30_request()
    Defined: ~/.vim/plugged/coc.nvim/autoload/coc/client.vim:134
Called 2 times
Total time:  60.065025
 Self time:  60.063749

count  total (s)   self (s)
    2   0.000056   0.000036   let channel = coc#client#get_channel(self)
    2              0.000020   if empty(channel) | return '' | endif
    2              0.000004   try
    2              0.000005     if s:is_vim
    2  60.064308  60.063052       let res = ch_evalexpr(channel, [a:method, a:args], {'timeout': 60 * 1000})
    2              0.000038       if type(res) == 1 && res ==# ''
    1              0.000043         throw 'request '.a:method. ' '.string(a:args).' timeout after 60s'
    1              0.000002       endif
    1              0.000004       let [l:errmsg, res] =  res
    1              0.000003       if !empty(l:errmsg)
                                    throw l:errmsg
    1              0.000001       else
    1              0.000003         return res
                                  endif
                                else
                                  return call('rpcrequest', [channel, a:method] + a:args)
                                endif
    1              0.000088   catch /.*/
    1              0.000021     if v:exception =~# 'E475'
                                  if get(g:, 'coc_vim_leaving', 0) | return | endif
                                  echohl Error | echom '['.self.name.'] server connection lost' | echohl None
                                  let name = self.name
                                  call s:on_exit(name, 0)
                                  execute 'silent do User ConnectionLost'.toupper(name[0]).name[1:]
    1              0.000019     elseif v:exception =~# 'E12'
                                  " neovim's bug, ignore it
    1              0.000003     else
    1              0.000227       echohl Error | echo 'Error on request ('.a:method.'): '.v:exception | echohl None
    1              0.000004     endif
    2              0.000008   endtry

==========================================

FUNCTION  CocAction()
    Defined: ~/.vim/plugged/coc.nvim/plugin/coc.vim:69
Called 1 time
Total time:  60.064558
 Self time:   0.000034

count  total (s)   self (s)
    1  60.064555   0.000031   return coc#rpc#request(a:name, a:000)

Add support to percentage alpha channel

For instance, rgba(0, 0, 0, 10) in C++ code is highlighted properly while rgba(0, 0, 0, 10%) is not. Therefore I tried to modify the colorFunction in server.js, but nothing changes. I don't know whether I need to build coc-highlight from source.

I've tested the following regexp with an online tester. If it is correct, would you please add it to the next release? Thanks.

const colorFunctions = /(?:\b(rgb|hsl)a?\([\d]{1,3}%?,\s*[\d]{1,3}%?,\s*[\d]{1,3}%?(,\s*\d?\.?\d+%?)?\))/gi;

The difference is that %? is added after the last \d+.

can't get it work

test code:

const color = 'red'

CocInfo:

## versions

vim version: NVIM v0.3.2-dev
node version: v11.2.0
coc.nvim version: 0.0.35
term: iTerm.app
platform: darwin

## Error messages

## Output channel: prettier

## Output channel: tsserver
[Info  - 下午11:46:33] Forking TSServer
PATH: /Users/aioiyuuko/google-cloud-sdk/bin:/Users/aioiyuuko/.pub-cache/bin:/Users/aioiyuuko/sdk/flutter/bin/cache/dart-sdk/bin:/Users/aioiyuuko/sdk/flutter/bin:/Users/aioiyuuko/.cargo/bin:/Users/aioiyuuko/.config/npm/bin:/Users/aioiyuuko/Library/Android/sdk/platform-tools:/Users/aioiyuuko/Library/Android/sdk/tools:/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin:/Users/aioiyuuko/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 
[Info  - 下午11:46:33] Started TSServer
{
  "path": "/Users/aioiyuuko/.config/coc/extensions/node_modules/typescript/lib",
  "_pathLabel": "",
  "_api": {
    "versionString": "3.2.1",
    "version": "3.2.1"
  }
}

## Output channel: eslint
[Info  - 下午11:46:33] ESLint server running in node v11.2.0
[Info  - 下午11:46:33] ESLint library loaded from: /Users/aioiyuuko/.config/npm/lib/node_modules/eslint/lib/api.js

## Output channel: highlight
[Info  - 下午11:46:33] Highlight server running in node v11.2.0



Highlight only Hex/RGB, not names

Is it possible to not highlight color names? I'm using a a CSS framework to configure colors and the names being highlighted is unnecessary and irrelevant in my use case.
image

Highlighting is slow

The highlighting seems to be really slow. Even for small files, it takes between 0.5 and 1.0 seconds.

Any chance for improvements or are you just passing the buffer to the highlight server which is the bottleneck here?

Color highlighting confused by 8 character hex values

Screenshot 2024-02-10 at 18 33 59

The first byte of 8 character hex values represents the alpha of the color. This extension gets confused. Instead of taking the last 3 bytes into account to draw the color, it takes the first 3 bytes into account.

Highlight scss vars

Highlight scss variables that are defined as colors. Currently only the variable declaration is highlighted, but the variable doesnt highlight when used.

// these are highlighted
$color1: red;
$color2: blue;
$color3: #345612;
$color4: #8833ca;

ul {
  // these are not highlighted
  background: $color1;
  color: $color2;

  li {
    // these are not highlighted
    color: $color3;
    background: $color4;
  }
}

high cpu usage

this just happened recently after upgrading all dependencies, coc-hightlight constantly take up more than 70% cpu

image

Conflict with solarized

Solarized is a very famous colorscheme. It has its own Wikipedia page (see https://en.wikipedia.org/wiki/Solarized_(color_scheme) ), therefore compatibility with Solarized could be cool. It seems have conflict with coc-higlight. I've tested lot of options, without success.

I've tested by put Solarized in ~/.vim/color or enable it with vim-plug . I've also tested with https://github.com/icymind/NeoSolarized .

Could you help me please ?

Sample of a minimal vimrc :

set nocompatible
filetype plugin indent on
syntax on
set hidden

" VimPlug
call plug#begin('~/.vim/plugged')

Plug 'altercation/vim-colors-solarized'

Plug 'neoclide/coc.nvim', {
            \ 'do': { -> coc#util#install()}
            \ }



call plug#end()

" coc-highlight works if the following line is commented
colorscheme solarized

" Smaller updatetime for CursorHold & CursorHoldI
set updatetime=300

" Following doesn't work
autocmd CursorHold * silent call CocActionAsync('highlight')


" Following doesn't work
highlight CocErrorHighlight ctermfg=Red  guifg=#ff0000
highlight CocWarningHighlight ctermfg=Red  guifg=#ff0000
highlight CocInfoHighlight ctermfg=Red  guifg=#ff0000
highlight CocHintHighlight ctermfg=Red  guifg=#ff0000

Highlight more than just one symbol/word like in VS Code

In VSCode you can select any text and all occurrences are highlighted, not just one symbol/word.
For example if I select this whole string in visual mode:

document.querySelector('.message').textContent

only the word under the cursor will be highlighted (i.e. max one of the four words), but not the whole string.

Is it possible to implement this behaviour? It helps when refactoring, because it shows you duplicate code.

Thanks

Disable Languages Description

The readme states:

  • highlight.disableLanguages, list of filetypes to ignore for this extension.

Could you give an example for that? If I want to disable hightlights in python files, should it be ['py'], ['.py'], ['*.py'] or ['python']?

can't change highlight color of current symbol

Hi guys,

I was trying to change the highligh color of the current symbol. The doc says:

Q: How to change highlight of the current symbol.
A: All you need is overwrite the highlight group, checkout :h coc-highlights

which specific highlight group though? :h coc-highlights shows a million of them :-)

thanks

在远程的vim中容易造成卡顿

使用vim9.0 patches: 1-1721版本,通过x11转发远程ssh登录使用vim,打开较大文件后用鼠标点击一些重复出现的字段就会造成卡顿,大约30s
"documentHighlight.timeout": 300,这个参数似乎没有起作用
下面是vim的profile:

FUNCTIONS SORTED ON TOTAL TIME
count     total (s)      self (s)  function
   24  39.544621220   0.001417911  coc#api#notify()
   83  39.540419146   0.003556463  14()
   17  39.493277391   0.003361428  10()
   11  39.465858174   1.195659071  coc#highlight#match_ranges()
16852  38.270199103                coc#string#byte_index()
   17   0.324125074                <SNR>33_execute()
   18   0.062008602                coc#highlight#clear_match_group()
   12   0.060328127   0.005637525  signature#sign#Refresh()
   44   0.036970401   0.000589137  qline#Statusline()
   44   0.035796056   0.030735091  <SNR>133_Statusline()
   94   0.028818657   0.004714733  coc#api#call()
   24   0.027472464                signature#mark#GetList()
  624   0.024138953   0.021591898  signature#sign#Remove()
   43   0.021801012   0.000970711  17()
   14   0.021417737   0.004216696  sy#start()
  440   0.019422681   0.002877345  <SNR>133_GetComponent()
   17   0.017173670   0.010763414  coc#util#get_bufoptions()
   14   0.016343683   0.014380204  sy#repo#get_diff()
  440   0.015586197   0.005120966  <SNR>133_GetComponentContent()
 1498   0.014198501                qline#config#Get()

FUNCTIONS SORTED ON SELF TIME
count     total (s)      self (s)  function
16852                38.270199103  coc#string#byte_index()
   11  39.465858174   1.195659071  coc#highlight#match_ranges()
   17                 0.324125074  <SNR>33_execute()
   18                 0.062008602  coc#highlight#clear_match_group()
   44   0.035796056   0.030735091  <SNR>133_Statusline()
   24                 0.027472464  signature#mark#GetList()
  624   0.024138953   0.021591898  signature#sign#Remove()
   14   0.016343683   0.014380204  sy#repo#get_diff()
 1498                 0.014198501  qline#config#Get()
   17   0.017173670   0.010763414  coc#util#get_bufoptions()
   17                 0.006018463  coc#util#variables()
   12   0.060328127   0.005637525  signature#sign#Refresh()
  440   0.015586197   0.005120966  <SNR>133_GetComponentContent()
   12   0.006421871   0.004784640  coc#vtext#add()
   94   0.028818657   0.004714733  coc#api#call()
   14   0.021417737   0.004216696  sy#start()
   24   0.004724687   0.004196681  <SNR>89_Highlight_Matching_Pair()
   52   0.004437896   0.004169909  <SNR>32_notify()
   83  39.540419146   0.003556463  14()
   14   0.004229882   0.003392158  sy#sign#process_diff()

Highlight current color code only

Is there a possibility to implement feature similar to highlight current symbol to show color of the current colorcode only on CursorHold or keys pressed?

Option to disable coc-highlight on large text files

I just found that if I open a text file of several MBs, the coc-highlight would be slow to do the highlighting work. It may take ~1s to react to the vim motion. If you are using Linux, you can test with the following commands.

$ du -sch vim /usr/lib/modules/`uname -r`/modules.alias
1.5M	/usr/lib/modules/5.6.15-arch1-1/modules.alias
1.5M	total
$ vim /usr/lib/modules/`uname -r`/modules.alias

Disable highlighting of color words

In GLSL there's a tan function and coc-highlight interprets it as the color and highlights it. E.g. here return fract(tan(distance(xy * PHI, xy) * seed) * xy.x); the tan is highlighted even if it doesn't mean anything in the context. I think it'd make sense to add an option to disable the highlighting of color words ("blue", "red", ...) so that this kind of thing doesn't happen.

No highlight on vim files

When coc-vimlsp is installed, there's no highlighting of symbols in any way.
Only by removing this extension, or setting a different filetype (:setf text), it highlights symbols.
How can I fix it?
Thanks.

[bug] color highlight will disappear after colorscheme

Reproduce Procedures

" File: $XDG_CONFIG_HOME/nvim/test.vim
" OS: linux v5.4.13
" Vi: nvim v0.4.3
" Py: cpython v3.6.10
" Term: guake v3.7.0
set runtimepath=$VIMRUNTIME,$GITHUBWORKSPACE/neoclide/coc.nvim
set termguicolors
" vi -u $XDG_CONFIG_HOME/nvim/test.vim

ired<Esc>

the word red will become red.

:colorscheme default<CR>

the word red will lose its color.

Change highlight color

With autocmd CursorHold * silent call CocActionAsync('highlight'), the highlighted background color is not ideal. Is it possible to change the highlight background color as an option?

Server highlight server failed to start: Connection is already listening

Started getting this message when opening neovim on macos and highlighting of colors is no longer working. Same result when using kitty or iterm 2:
[coc.nvim] Server highlight server failed to start: Connection is already listening

Output of :CocInfo:

## versions

vim version: NVIM v0.4.3
node version: v13.7.0
coc.nvim version: 0.0.77-daefc02592
term: xterm-kitty
platform: darwin

## Messages
[coc.nvim] Server highlight server failed to start: Connection is already listening
1 line less; before #1  1 second ago
## Output channel: git

Looking for git in: git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git

Error 128 on: 'git rev-parse --show-toplevel' in /Users/nikhil
fatal: not a git repository (or any of the parent directories): .git

## Output channel: snippets


## Output channel: prettier


## Output channel: highlight

[Error  - 2:43:33 PM] Starting client failed: 
Error: Connection is already listening
    at throwIfListening (/Users/nikhil/.config/nvim/plugged/coc.nvim/build/index.js:16095:19)
    at Object.listen (/Users/nikhil/.config/nvim/plugged/coc.nvim/build/index.js:16334:13)
    at Object.listen (/Users/nikhil/.config/nvim/plugged/coc.nvim/build/index.js:54368:34)
    at /Users/nikhil/.config/nvim/plugged/coc.nvim/build/index.js:56412:24
[Info  - 2:43:33 PM] Highlight server running in node v13.7.0
[Error  - 2:43:33 PM] (node:18608) UnhandledPromiseRejectionWarning: Error: Unhandled method highlight/iskeyword
    at handleResponse (/Users/nikhil/.config/coc/extensions/node_modules/coc-highlight/lib/server.js:614:48)
    at processMessageQueue (/Users/nikhil/.config/coc/extensions/node_modules/coc-highlight/lib/server.js:441:17)
    at Immediate.<anonymous> (/Users/nikhil/.config/coc/extensions/node_modules/coc-highlight/lib/server.js:425:13)
    at processImmediate (internal/timers.js:456:21)
[Error  - 2:43:33 PM] (node:18608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[Error  - 2:43:33 PM] (node:18608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Output of :CocOpenLog:

2020-03-17T14:47:03.207 INFO (pid:18652) [services] - registered service "eslint langserver"
2020-03-17T14:47:03.218 INFO (pid:18652) [services] - registered service "highlight server"
2020-03-17T14:47:03.365 INFO (pid:18652) [plugin] - coc 0.0.77-daefc02592 initialized with node: v13.7.0
2020-03-17T14:47:03.369 INFO (pid:18652) [language-client-index] - highlight started with 18654
2020-03-17T14:47:03.373 INFO (pid:18652) [services] - highlight server state change: starting => stopped
2020-03-17T14:47:03.394 ERROR (pid:18652) [extension-coc-highlight] - highlight server start failed: Connection is already listening
2020-03-17T14:47:03.427 INFO (pid:18652) [services] - highlight server state change: stopped => running

Let me know if I can provide any other info. Thanks!

HELP: What does the "highlight curreny symbol" actualy does?

including document highlight (highlight of current document symbol) and colors highlight.

Hi this is just a doubt, i am using the plugin and the colors highlight is working fine

2020-12-31_01-19

But i am not sure what the other part means, what exactly is the highlight of "current document symbol"? Could someone show me please?

Color highlighting at wrong position in lines with characters requiring UTF-16 surrogate pairs

A basic example to repro: pasting 🗎 red into an empty buffer with coc-highlight enabled will result in the following.
image

Inspecting the character with ga, we find that we're dealing with U+1F5CE, which becomes 0xD83D 0xDDCE in UTF-16.
My assumption here is that, due to "🗎".length === 2, the highlighting gets applied to the wrong columns, as the code assumes there's two characters, even though they only take up one column of screen space.

MDN's page on String.length suggests a function like the following to count the actual characters:

function getCharacterLength(str) {
  return [...str].length;
}

I am not familiar with the codebase, but I might contribute a fix myself if it seems easy enough.

Lastly, I want to note that a similar issue exists with the post-yank highlighting in coc-yank. If you want me to open an issue over there as well, I can do so, but I decided against it for now because I didn't want to open two issues with essentially the same body text.

Do not highlight HTML entities

The current highlighting for colors should not highlight the color when prefixed with the & character. I suggest to add a look-around here by optimizing the regex to:

const colorHex = /(?<=\W|&|^)((?:#)([a-f0-9]{6}([a-f0-9]{2})?|[a-f0-9]{3}([a-f0-9]{1})?))\b/gi

(The above adds & to (?<=\W|^)). See regex101 for working demo.

Screenshot
Screenshot 2019-08-14 at 16 18 56

Disable highlighting in specific `hi` groups

I like the highlighting this plugin provides, but it is a bit distracting when scrolling through code comments and having the comment words highlighted.

One generic way to solve this would be to make it possible to disable highlighting within specific highlight groups. This way I could disable the plugin for the Comment group and have the best of both worlds.

I'm not sure if this is at all feasible, but I figured I would ask.

HSL Color Issues

It appears that HSL can only be parsed as /hsla?\(\d{1,3},\s*\d{1,3}%,\s*\d{1,3}%(,\s*\d{1,3})\) which is more restrictive than the current regex which leads to many errors being dumped to the console and it being unclear to the user what format they need to input for highlighting. It would be useful if there was support for much laxer constraints, enabling floating point input which is common in HSL and HSV since RGB rarely translates exactly to integers, and additional color models like HSV(K), CMYK, etc.

I can probably submit a PR fixing the console errors currently by just making the regex less lax if that is desirable.

Intelligent text coloring

It might be useful to choose between a black or white text color depending on perceived brightness. A proposed implementation, adapted from here where Color::luminosity returns human-perceived luminosity:

function getTextColor(bgColor: Color): Color {
  return new Color(bgColor.luminosity() > 0.5 ? 'black' : 'white')
}

For instance, in this image, the #343a40 is hard to read:


EDIT: Fixed in neoclide/coc.nvim@e5da464

Hang when closing a large json file

I was editing a large compile_commands.json file and noticed that highlight caused a hang when exiting. Disabling this extension fixed it.

Error opening file in `git` directory: `Error: No Project`

Having the following error message (:messages) in neovim:

[coc.nvim] Error on 'highlight': Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:92289:23)
    at ProjectService.getDefaultProjectForFile (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:94518:46)
    at IOSession.Session.getFileAndProjectWorker (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:96934:87)
    at IOSession.Session.getFileAndProject (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:96919:29)
    at IOSession.Session.getDocumentHighlights (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:96692:31)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:96233:61)
    at /Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:97580:88
    at IOSession.Session.executeWithRequestId (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:97571:28)
    at IOSession.Session.executeCommand (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:97580:33)
    at IOSession.Session.onMessage (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:97600:35)
    at Interface.<anonymous> (/Users/gs069673/git-repos/techportal/node_modules/typescript/lib/tsserver.js:98831:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:280:10)
    at Interface._normalWrite (readline.js:422:12)
    at Socket.ondata (readline.js:139:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:597:20)

To reproduce:
(I have NERDTree enabled by default)

  1. Go into a Git project root directory and do $ nvim. (I set in my .vimrc that $ nvim alone will open the directory in NERDTree)
  2. Pick a file by moving your cursor onto a file node inside the NERDTree buffer.
  3. Open the file by hitting Enter on the file node inside NERDTree.
  4. You will notice that there's part of the error message showing at the bottom, in the Vim command area.
  5. Do a :messages you will see the whole error messages that I pasted above.

NeoVim 0.3.7;
macOS 10.14.5;

Please help. Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.