Brace style, Auto-formatting, Code hinting
已回答
Hey there. I'm having a stab at implementing my own custom language plug-in. It's going pretty well, although I'm finding the documentation to be severely lacking.
In particular I am having trouble figuring out the following..
1. How do I implement the "brace style" formatting option? (End of line, Next line, etc)
2. How do I auto-format a block when the user types the closing-brace like other languages do?
3. How do I implement these tooltip code-hints? https://gyazo.com/792e6ab76e4f766febc309098d3557e0
I have many more questions but currently these are the most pressing.
I'd appreciate any help anyone might be able to offer. Thanks in advance!
请先登录再写评论。
Thomas, thanks for reaching out with your questions!
Brace style formatting uses the BraceStyleAccessor, BraceStyle, and AbstractJavaBlock. This is a Java-specific solution, but you can verify the sources to get an insight into how it's handled.
Auto-formatting the block of code after typing the closing brace happens automatically for all languages based on the "IDE Settings -> Editor -> Smart Keys -> Reformat block on typing '}'" option, and general language's code styles are applied.
Code hints can be handled with the documentation provider.
Thanks, but auto-formatting is not happening when I type "}" despite the option being enabled.
Do i need to implement "folding" support for this to work?
I've implemented code folding and the "}" thing is still not working.
The documentation provider works for hover tooltips, but it doesn't offer help as you type.
I think what I need is a CompletionContributor, but I don't know how to add function parameter information and have it switch between parameters as you type.
I managed to solve the auto-formatting on close brace issue
I needed to implement `PairedBraceMatcher`
Then add it to the plugin.xml: