Open jordwalke opened 11 years ago
You actually should be able to do most of this by using the syntax highlighting. You should be able to add a scope to a given character range and then have the theme set certain properties based on that. Unfortunately wavy underlines aren't part of the supported options, I don't think, mostly because they're not built in to Cocoa.
I added some of this experimentally to vico-ensime
a while back: https://github.com/Shadowfiend/vico-ensime.vicobundle/blob/master/ensime-status-commands.nu . I chose the scope severity.(warning|error)
, I believe. I did have to edit the theme file directly; it would probably be ideal if there were a default set for those theme settings.
Notably, spellcheck underlines have switched to dashed underlines instead of wavy, so that may be a possibility.
I've tagged this feature, which I'll use to track a built-in way of doing this highlighting.
If you have access to this information, it'd be handy if you could see what if any scopes TextMate uses for these, if TextMate has this ability.
Oh wow - that's awesome. I'm not set on wavy underlines - dotted probably look even better IMHO. So then I just need the ability (some kind of hook) to be able to reevaluate the syntax on every keystroke I believe (with some kind of delay + debounce). If your vico-ensime
plugin already does this then I can just copy it and begin writing the javascript highlighter.
IIRC: There are some textmate themes with error colors - so we could use those - but would there be a way to just use the "misspelling dotted underline" IMHO it looks the best! Can we simply mark a region as "incorrectly spelled"?
I'm tempted to leave it up to the theme rather than forcing a setting on the user, though I'm open to suggestions.
I still need to look into exposing the dotted underline style, however.
Yeah - I always wished it was themeable in Macvim.
What do I have to do to get the script to be reevaluated continually (after some elapsed time of non-typing?) Where's the place I can start looking?
The Vico API docs are actually still reasonably up-to-date. caretDidMove
is the event that is current exposed that is perhaps best suited to this, though it'd be nice to expose an event for the actual text changing (say, when you leave insert mode). Right now it will be a bit noisy, since it'll be all caret movement, not just that caused by typing.
For the part where you wait a certain amount of time, you can use NSTimer
to schedule a selector invocation after a certain interval, and use invalidate
on the timer to stop it if the user takes action in the meantime.
I started playing with this and it looks like some of the example scripts are outdated.
Do you know why ((document fileURL) path)
no longer works? What's the new way to get the path of a document?
I think you want ((current-document) fileURL)
.
It would be great to have a hook for highlighting errors inline. If this is implemented, I'll create a JavaScript error/lint highlighter for Vico.
Here's a nice way to visualize errors: