Coder Social home page Coder Social logo

Support .less about vim-css-color HOT 9 CLOSED

ap avatar ap commented on July 18, 2024
Support .less

from vim-css-color.

Comments (9)

ap avatar ap commented on July 18, 2024

Works just fine for me, and since you’re getting the errors it would seem it’s even working for you.

Are you running another, naughty plugin that does clearmatches() on the buffer?

If so, file a bug against it and tell the maintainer to make it keep track of which matches it owns instead of just bulldozing everyone’s matches. I.e. that plugin needs a line like the one you commented out (plus equivalents of line 222 and 257), instead of this plugin needing that line commented out. And this issue can be closed.

If not, then we’ll have to investigate further.

from vim-css-color.

torgeir avatar torgeir commented on July 18, 2024

Oh, I see. I'll reopen if it that's not the case, thanks!

from vim-css-color.

torgeir avatar torgeir commented on July 18, 2024

You were quite correct, sir, and it was my own, from before bothering to understand vimscript
https://github.com/torgeir/vim/blob/0d0704c4779c6a28ed3d3a31e53582b49997a846/config/trailingwhitespace.vim

Fixed, thanks! :)
https://github.com/torgeir/vim/blob/master/config/trailingwhitespace.vim

from vim-css-color.

littke avatar littke commented on July 18, 2024

I found it in the very popular Command-T: https://github.com/wincent/Command-T/blob/master/ruby/command-t/match_window.rb#L118

My chance of getting that fixed upstream are tiny, I guess.

from vim-css-color.

ap avatar ap commented on July 18, 2024

Are you sure? @wincent does not seem like someone who would need a lot of convincing on this. It doesn’t even seem hard to add, it seems he only ever adds three matches. Those would need to be replaced with calls to matchadd() which returns an ID that can then be deleted selectively using matchdelete() instead of nuking everything with clearmatches() (just as vim-css-color does). Not much work. I might have a go at a patch myself, though I’d need to brush off my Ruby.

from vim-css-color.

littke avatar littke commented on July 18, 2024

No, not sure — I just assumed @wincent was the kind of guy who knew very well what he did, and that perhaps he had good reasons to do this way.

May I ask if you could submit the issue? I'm on thin ice here :) If not, I'll do my best.

The errors I'm getting are these:

Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   32:
E117: Unknown function: s:rgb2xterm
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   32:
E15: Invalid expression: s:rgb2xterm(rgb_color)
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   33:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   38:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   38:
E15: Invalid expression: s:hex[rgb_color[0:1]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   39:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   39:
E15: Invalid expression: s:hex[rgb_color[2:3]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   40:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   40:
E15: Invalid expression: s:hex[rgb_color[4:5]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   41:
E121: Undefined variable: r
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   41:
E15: Invalid expression: r*30 + g*59 + b*11 > 12000 ? s:black : s:white
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   42:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   49:
E254: Cannot allocate color #
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line   49:
E417: missing argument: guifg=
Press ENTER or type command to continue

I'm seeing now that the ID not found is not mention here, but I've seen that error too. Not sure if they're related. I'm editing a .less file and once I'm typing hsl(12, 12%, 12, that's when the error pops up. Hoep I'm in the right place. Thanks.

from vim-css-color.

wincent avatar wincent commented on July 18, 2024

Ah, thanks for CC'ing me on this. I didn't even know I was doing it wrong; added the clearmatches call misguidedly 4 years ago: wincent/command-t@d06f51f

I'll create an issue for this.

from vim-css-color.

littke avatar littke commented on July 18, 2024

Awesomesauce.

from vim-css-color.

ap avatar ap commented on July 18, 2024

@wincent: don’t feel bad – seems like just most people are doing it: someone else just found it in CtrlP, and I saw a clearmatches() in some competing colour highlighter plugin myself. It’s no surprise either, Vim’s API is pretty much inviting the mistake. The only reason I’m not among everyone in this is because vim-css-color by definition coexists in a buffer alongside other more important plugins, so I knew I had to be circumspect in a way that might not have occurred to me if I was writing a plugin that I thought of as owning a buffer.

In fact I debated putting in a try/catch and silencing the error, because I can foresee this causing bug reports forever hence, since after all the Vim API invites the use of clearmatches(). But OT1H, the reason I added the matchadd() stuff was to support cursorline users – if I accept those matches getting cleared away then that support may appear to work randomly only. And OTOH, those other plugins as written genuinely do not coöperate well with others within a buffer, when it comes to match highlighting, and probably ought to be fixed not just for the interests of vim-css-color alone. So I chose to leave vim-css-color exposed to exceptions and to accept going the boil-the-ocean route.

from vim-css-color.

Related Issues (20)

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.