Skip to content
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

Document Formatting #4

Open
arthurgreef opened this issue Apr 23, 2020 · 1 comment
Open

Document Formatting #4

arthurgreef opened this issue Apr 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@arthurgreef
Copy link

Hi - is it possible to get a document formatting feature? Sometimes it is really hard to debug when you have a mismatched {} and the eval output error line number is the last line of the program, and the real problem is somewhere else.

@tgrospic
Copy link
Owner

Hi Arthur! Formatting is definitely very useful feature. Adding support to the extension or creating new formatting extension is not difficult part. Here is the summary.
https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices#_summary

The part where all the formatting logic is in the implementation of DocumentFormattingEditProvider which should analyze selected Rholang code/file and do the work. I don't see support to work with parser output but only to work directly with string.

This basically means that, adding formatting support to the extension is hard as writing function (document: vscode.TextDocument): vscode.TextEdit[] (for range formatting position must be also included).
Here is the simple formatting extension example.
https://github.com/jrieken/vscode-formatter-sample/blob/master/src/extension.ts

@tgrospic tgrospic added the enhancement New feature or request label May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants