-
Notifications
You must be signed in to change notification settings - Fork 591
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
[Haskell] Add Cabal Syntax #2682
[Haskell] Add Cabal Syntax #2682
Conversation
It appears Cabal to be the default package manager used by Haskell. It might therefore make sense to have basic support for Cabal configuration files available next to Haskell syntax itself.
Use a more lazy matching strategy to match also probably incomplete or yet unknown tags.
Use `meta.toc-list` to add section headers to local symbol lists and make both the section kind and name available for Goto Symbol.
f06be56
to
49ca1cb
Compare
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 just took a brief look as I had some time to kill. I've never used cabal before, and I can't comment on its usage in the Haskell ecosystem, but generally this looks fine to me.
The final `+?` is no longer needed as the final `>` is not checked. Both <[email protected]> and [email protected] are matched as email address.
Over all this seems fine. Was there a reason, |
Sections are displayed in Symbol List via Symbol tests have not been prominent and important enough. |
Not specific to only this PR, but maybe we can unify the scope names used for punctuations within mappings? What's currently used in various syntaxes (on master):
*not sure whether the Lua tables are directly comparable to the other mappings listed here Any more that I have forgotten? |
|
My intention is mostly to have unified scope names between syntaxes, so as long as it is used consistenty, I could live with the It's just that it is redundant due to the For CSS, I can understand that it wasn't changed to |
@jwortmann Please open a new issue for that discussion. That's really off topic here! |
They are tagged |
By marked as definitions I mean they show up in goto-symbol, which I'm not sure is desirable considering the amount of duplicates. |
I found a possibility to quickly navigate to those keys useful. If not, we can remove Cabal Symbol List |
The top-level entities should certainly be there, but non-top level stuff like "build-depends" doesn't seem useful. fwiw I'm not a user of this so maybe it makes sense to include those for a reason I'm not aware of. |
There's no difference between top- and none-top-level keys, logically. Former ones just describe globals, while latter ones single assets or build targets. The meaning however is the same within their scope. Syntax currently doesn't distinguish them and I am uncertain I want to add this level of complexity. So it's all or nothing. |
Only known tokens are supported as section headers (see |
Solver syntax is not implemented, currently. Seems to be related with dependencies however. |
Any valid identifier starting a line and not followed by colon is scoped section header.
c4e7d32
to
04db79e
Compare
All review comments are addressed. |
This seems fine, though seeing support for some |
v3.4 was the up-to-date spec version at the time of writing cabal syntax. It doesn't mean it shouldn't support newer features. |
Great work! @deathaxe, was this released with BUILD 4142? |
The pull request is still open. deathaxe has addressed all comments by SublimeHQ two months ago already. @FichteFoll hasn't re-reviewed yet, and the PR still needs another review to be merged into the |
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.
Since perfect is the arch-enemy of good, I'll approve of this PR in its current state. If any of these are things you want to work on, @deathaxe, be my guest, but I wouldn't block a merge on them.
-
There are still debates to be had regarding the key scope, but since we don't have a clear direction on this yet, this particular PR is not the place to discuss and decide on it.
-
Similarly, some key-value pairs definititely look like the value should be an unquoted string (much like in YAML) where they currently only have
meta.mapping.value
. Again, not something I'm hung up upon. -
The other thing I noticed was stacking of
meta.function-call
, but also not a requirement for me for such a rarely used syntax.
to 1.) I'd be happy with any suitable scope of those keys as we don't even have categorized this kind of files. We could treate them as mappings / structured key-value pairs and use json/yaml scopes. It wouldn't be the worst choise, but there's no real need to distinguish data types of keys like in YAML. Scoping it string therefore feels a little odd as everthing in those files is a string and we'd have the same kind of discussions about "everything is string scoped" as we had/have for JSON/YAML. As Cabal is basically Haskell's Makefile the question arises, how to scope ... but well, that's probably a separate topic. to 2.) Same here. We could scope them to 3.) Do you have any examples? Or is it |
Re 3.: No, I don't. Not sure what I was seeing there exactly but I certainly don't see it anymore. |
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.
Since perfect is the arch-enemy of good, I'll approve of this PR in its current state.
➕
Suggestions for better scopes are always wellcome. |
This PR proposes to add basic support for Cabal Configuration Files.
It appears Cabal to be the default package manager used by Haskell. It might therefore make sense to have basic support for Cabal
configuration files available next to Haskell syntax itself.
It is known not to be intended to add further rarely used syntax definitions to the repo in general. We might also add it as dedicated package to Package Control then.