Giter Club home page Giter Club logo

Comments (2)

ap avatar ap commented on July 27, 2024

A bit more info would be useful – until now I wasn’t aware of Svelte… which is presumably what you are asking about?

I find evanleck/vim-svelte and leafOfTree/vim-svelte-plugin for that – are you using one of those? If you have any sense of this, would you say they are both popular? Do people use something else?

Oddly, the way those plugins are constructed and the way CSS Color is built, I think it should be getting loaded automagically already, in which case your issue would be a bug rather than a feature request. But this is preliminary only as I haven’t done any testing yet and may find I was misremembering or overlooking something once I do.

from vim-css-color.

ns740 avatar ns740 commented on July 27, 2024

A bit more info would be useful

apologies

svelte files have html, javascript and css styling all together in one file.
javascript is between <script> tags and css is between <style> tags.

i am using the leafOfTree plugin. It sets the filetype to "svelte" and dynamically sets a subtype as the cursor moves through the file and fires an event OnChangeSvelteSubtype(subtype) when it changes. But the filetype is just set to svelte.

there is a note in the plugin readme:

filetype is set to svelte so autocmds and other custom settings for javascript have to be manually enabled for svelte.

which is what the "kludge" fix in the OP does (it cloned the css settings to create new svelte settings)

TBH i don't know enough about how this works and what other plugins (like linters?) are listening to that subtype event - it might be that vim-css-color doesn't need such precise tracking. I've been running with my "svelte.vim" setting hack which just treats a svelte file like a css file and the colors get interpreted just fine. There probably is an edge case where a javascript constant will look like a color and vim-css-color will argue with syntax highlighting but i haven't seen it yet. It's sort of working but doesn't seem like a clean, proper fix.

there are some the tricky things happening in the /after/syntax/*.vim files. Like "runtime" for example. there seems to be a lot of functionality there for reusing code from other filetypes. i might be able to help with a PR if i understood how these files work. And maybe the "right" way to do this is to only operate on the stuff between <style> tags. (Currently i'm clueless how to do this though).

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.