-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sass variable matcher. #22
base: master
Are you sure you want to change the base?
Conversation
Usage will be in two parts: 1. Setting your setup file: ``` setup { scss = { custom_matcher = require'colorizer/sass'.variable_matcher }; } ``` 2. Attaching to a buffer to trigger updating the dictionary. ``` autocmd FileType scss lua require'colorizer/sass'.attach_to_buffer() ``` Demo https://github.com/norcalli/github-assets/raw/master/colorizer-demo-sass.gif https://github.com/norcalli/github-assets/raw/master/colorizer-demo-sass.mp4 Only the buffers which have been attached will be considered for variable definitions.
TODO:
|
For the record, based on the reddit comment timestamps, it took me only an hour to implement :P |
lua/colorizer/sass.lua
Outdated
colorizer.attach_to_buffer(bufnr) | ||
end | ||
end | ||
-- TODO can this get out of sync with highlighting order if it updates the database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete comment
lua/colorizer/sass.lua
Outdated
local length, rgb_hex = VALUE_PARSER(variable_value, j) | ||
if length then | ||
variable_definitions_changed = true | ||
print("parsed variable value", variable_name, length, rgb_hex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete prints
Thanks @norcalli ! I'm guessing that the |
@alxndr It depends on how you were doing your setup already. Here's an example: lua << EOF
require 'colorizer'.setup {
'*';
scss = { custom_matcher = require'colorizer/sass'.variable_matcher };
}
EOF |
I'm using vim-plug, and I've
I haven't yet used Lua with Neovim so I'm unfamiliar with what else might be involved in setting up a plugin that uses it. |
@alxndr Putting it in the |
Okay, thanks. So I've got the
However when I start up Neovim I see this error at the top of a long stack trace (?):
(Line 206 is the last line of the snippet I shared above, with just Thanks for looking into this! |
@alxndr You're going to want to use |
Aha, thank you! Here's the bare-bones init file I used to get this working:
|
@alxndr have you been using this branch? I'm interested in trying to get it merged and I want to hear any feedback first. |
I've been using it on and off, and it's very nice! Minor bug? General feedback
|
Looks amazing! Any chance of getting it merged at some point? Thanks for great plugin @norcalli! |
I have implemented sass support in my repo, loosely based on this pr. Along with support for imports, recursive imports and variables. |
Usage will be in two parts:
Demo https://github.com/norcalli/github-assets/raw/master/colorizer-demo-sass.gif
https://github.com/norcalli/github-assets/raw/master/colorizer-demo-sass.mp4
Only the buffers which have been attached will be considered for variable definitions.