Open VenInf opened 1 week ago
Thank you for working on this feature, it seems like a great addition to the plugin! Could you add a screenshot of what the feature looks like in action?
Thank you for working on this feature, it seems like a great addition to the plugin! Could you add a screenshot of what the feature looks like in action?
Yes, sure.
There is how the outline looks for haskell-language-server.cabal
file and simple.cabal
file from cabal plugin tests.
I was trying out the feature, it looks like a great start!
But, I think there is some unwanted behaviour here.
Firstly, I think it would be less overwhelming to only see the parents in the outline by default, with everything else collapsed.
Secondly, I think it would be easier to use the outline if the names of stanzas were part of the respective elements instead of being a child.
Also, I think the if conditions are not grouped correctly as can be seen below.
I think, it could also make sense to not show leaf values in the outline at all? Specifically for long descriptions or exposed-modules content, the text becomes rather long.
I was trying out the feature, it looks like a great start! But, I think there is some unwanted behaviour here. Firstly, I think it would be less overwhelming to only see the parents in the outline by default, with everything else collapsed.
I thought that this will be an easy fix, but it looks like that it's unclear, who can provide such settings. It certanly can be done manualy, but I can't tell if it's possible to do by default. I will look into it, but I will be glad to hear any ideas for a soltion.
Secondly, I think it would be easier to use the outline if the names of stanzas were part of the respective elements instead of being a child. Also, I think the if conditions are not grouped correctly as can be seen below.
Right now the outline displays the cabal's AST without any modifications. I think it will be nice to see the if statements in one line, and looks like it can be done by jamming all SectionArg
s on one level in one DocumentSymbol
. I will test this.
I think, it could also make sense to not show leaf values in the outline at all? Specifically for long descriptions or exposed-modules content, the text becomes rather long.
At least for me it's not obvious, what data should be displayed, and what omitted. As far as I can tell, it can be independent with the depth in the cabal's AST.
I think a collapsed outline would solve this issue as well.
I don't think we have any control over whether or not the outline is expanded or not.
At least for me it's not obvious, what data should be displayed, and what omitted.
As I understand it, the outline view is generally used for navigation between named entities in the file. So I definitely don't think we should be including the values of fields, that's quite odd.
I think having the top-level field names is probably useful, in that it allows jumping to them, but I think it would be nice to group them in a "top-level stanza" element, perhaps?
Fixed some minor issues, and hopefully solved the problem with displaying values of the fields.
Also now the Section
and SectionArgs
are displayed in one line.
For example source-repository head
and if impl(ghc >= 9.8)
Fixed some minor issues, and hopefully solved the problem with displaying values of the fields. Also now the
Section
andSectionArgs
are displayed in one line. For examplesource-repository head
andif impl(ghc >= 9.8)
This looks great!
To fix the pre-commit failing, you will want to run the stylish haskell
formatter on your code, especially the imports.
Once the functionality will be set I will implement the tests.
The tests are now implemented as well.
This is an attempt to solve an issue #4282. It adds an Outline for the cabal files.
Implementation details
Using runIdeAction we get parsed cabal fields with positions of the keywords.
This can be transformed with a series of functions to the DocumentSymbol. It is returned, and the
moduleOutline
can be plugged in to the cabal descriptor.What is not implemented / any issues.
SymbolKind
s are chosen arbitrary, for now.