pragmagic / vscode-nim

An extension for VS Code which provides support for the Nim language.
Other
237 stars 37 forks source link

Support code formatting #79

Closed ghost closed 5 years ago

ghost commented 6 years ago

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
lppedd commented 6 years ago

This one would be nice!

ghost commented 6 years ago

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

kosz78 commented 6 years ago

I will try add nimpretty tools invocation in vscode

ghost commented 6 years ago

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

ghost commented 6 years ago

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

ghost commented 5 years ago

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

ghost commented 5 years ago

It works!

girng commented 4 years ago

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

ghost commented 4 years ago

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

girng commented 4 years ago

@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.