-
Notifications
You must be signed in to change notification settings - Fork 144
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
Use a single Vec<Context> in SyntaxSet after linking #187
Conversation
examples/syncat.rs
Outdated
builder.load_syntaxes(folder, !no_newlines).unwrap(); | ||
ss = builder.build(); | ||
// TODO: no way to go back to builder anymore :/ | ||
//let mut builder = ss.builder(); |
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.
I think we can bring this back by recreating all the SyntaxDefinition
s from the SyntaxReference
s and their contexts, but haven't looked into this yet.
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.
Hmmm that may be an issue, as I mentioned in the other PR, it would be nice for editors to be able to load new syntaxes on the fly. Mostly thinking of Xi.
Three options:
- Just make editors reload everything on adding a new syntax, which may be fine because they might want to create their own dumps for fast startup, and reloading shouldn't be that slow.
- Maybe have the builder also have context/references
Vec
s that are only used when creating from an existing set. This might be pretty easy. - What you said, recreate the original structures.
@trishume This is not yet the end state you had in mind, but just a step in that direction. A further step would be to get rid of The reason I left it is because it was easier to do this step, and because I'm wondering if it would be useful to keep both types in the API ( |
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.
Looks good!
Since this is a PR to another PR of yours I'll leave it up to you how/when you want to do merging/branching from here. I won't hit the button and you can or you can keep branching further, either works.
examples/syncat.rs
Outdated
builder.load_syntaxes(folder, !no_newlines).unwrap(); | ||
ss = builder.build(); | ||
// TODO: no way to go back to builder anymore :/ | ||
//let mut builder = ss.builder(); |
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.
Hmmm that may be an issue, as I mentioned in the other PR, it would be nice for editors to be able to load new syntaxes on the fly. Mostly thinking of Xi.
Three options:
- Just make editors reload everything on adding a new syntax, which may be fine because they might want to create their own dumps for fast startup, and reloading shouldn't be that slow.
- Maybe have the builder also have context/references
Vec
s that are only used when creating from an existing set. This might be pretty easy. - What you said, recreate the original structures.
src/parsing/syntax_set.rs
Outdated
|
||
let context_map = ContextMap::new(scopes, syntax_names, context_names); | ||
|
||
// 2 loops necessary to satisfy borrow checker :-( |
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.
:-)
b3a51e8
to
822c472
Compare
85ce859
to
822c472
Compare
Rebased both branches and incorporated this into the other PR. |
This means resolving a
ContextId
is now a single lookup.Having the
SyntaxSetBuilder
(introduced in a previous commit) helped make this change.This is a separate PR to hopefully make it easier to review, but it's part of the larger work in #182.