pragmagic/vscode-nim

Support code formatting

Closed this issue ยท 10 comments

It would be very nice, if formatting code would be supported, when pressing CTRL+Shift+P and than on format document (resp. the direct combination).

For example:

var x:int=2   
echo     x

should be formatted to something like

var x: int = 2
echo x

This one would be nice!

Just saw that there is something in development similar to nimsuggest: https://github.com/nim-lang/Nim/blob/devel/tools/nimpretty.nim

I will try add nimpretty tools invocation in vscode

Thank you very much for your work on this.
When the marketplace version is updated I will test it :-)

AFAIK nimpretty is not yet complete and should not be used as it can cause problems.

I have the latest version of nim (windows x64), nimpretty and this plugin installed, and an option to format the document is in the context menu, but when I click on it, it doesn't do something.
I manually tested nimpretty using nimpretty file.nim and this works and it's in path.
I also tried to change the filename to nimpretty2 and restarted vscode, then I get a warning that the binary isn't found so it seems to find the binary.

I also tried to start vscode as admin, didn't change.

Edit: The log says I have an unknown error:
log.ts:171 ERR

It works!

girng commented

@Tim-St where are you finding that nimpretty executable? I can't find it with the latest windows build zip

@girng I've compiled it myself. I think there was a nimpretty folder.

girng commented

@girng I've compiled it myself. I think there was a nimpretty folder.

Nice, I did that but then rage-quit last night because vscode still kept saying it couldn't find the nimpretty binary :/

Even when nimpretty is in my path and works when in the console.