vlang / vscode-vlang

V Language extension for Visual Studio Code.
MIT License
385 stars 51 forks source link

v.fmt not working #523

Open esimov opened 1 year ago

esimov commented 1 year ago

I have installed Vlang together with the vscode plugin on my Windows environment, but it looks like that none of the supported commands are working. For example when I'm trying to run v.fmt by pressing CTRL+SHIFT+P I'm getting the following error:

esimov commented 1 year ago

I figured it out, that v ls wasn't installed and this was the reason that I was getting the above error. Maybe it would help the future developers who want to try out the language somewhere to be mentioned that v ls should be installed in order to use the VsCode plugin.

JalonSolov commented 1 year ago

The plugin used to ask if you wanted to install vls. Perhaps this is a regression.

esimov commented 1 year ago

It didn't asked me.

esimov commented 1 year ago

It's not related to the original question, but how can I enable the autoformat function on file save? Is it possible or only by using the CTRL-SHIFT-P + V: Format current file command?

JalonSolov commented 1 year ago

Did you enable vls in the options?

I don't use vscode, so not sure, but most editors have a way to set up "do this when saving a file" operations.

esimov commented 1 year ago

Yes, I did. Also "editor.formatOnSave" is set as true globally, but for V is not working unfortunately.

robvanmieghem commented 1 year ago

v.fmt is not called by vscode to format files on save. There is no explicit languageformatter registered for v, formatting is done through the language server. "editor.formatOnSave" does work for me though when vls is enabled.