-
Notifications
You must be signed in to change notification settings - Fork 13
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
Code formatting isn't working for me with VS Code #122
Comments
Appears to be the same issue as #50 Adding I'll close this one then 😄 |
I guess I hadn't considered adding -nst in the code. I can go ahead and do that. |
Thank you so much! 😄 |
Just wanted to re-open this as there seem to be multiple issues (at least for me). The For example, I increased the indent to 8 for demonstrational purposes: This is my
My little input file is: package Greeter;
use 5.036;
our $VERSION = 1.0;
sub get_greeting ($name) {
return "hi there ${name}";
}
1; Using the package Greeter;
use 5.036;
our $VERSION = 1.0;
sub get_greeting ($name) {
return "hi there ${name}";
}
1; However, donig this in VS Code with PLS indents to a 2-space indent: package Greeter;
use 5.036;
our $VERSION = 1.0;
sub get_greeting ($name) {
return "hi there ${name}";
}
1; Using the other mentioned extension works as expected 😄 Any ideas? |
What about your VSCode settings? Your tab settings in VSCode are also taken into account when formatting. |
Thanks heaps for the reply. I've tried this with an empty VS Code configuration file only containing the However, I did some more digging based on your comment and as you mentioned, PLS will indent completely based on the indent level of the file (which may be auto-detected). I got this working as follows in my VS Code config: "[perl]": {
"editor.tabSize": 8,
"editor.detectIndentation": false
} However, I'm not sure that PLS should consider the VS Code indent level; after all this is why Perl Tidy exists, to ensure that code conforms to a specific style and this should ideally be fully specified in What do you think? |
Just a further thought, the current behaviour will likely cause conflicts with I'd at least love the option to turn this behaviour off and make |
While I don't necessarily disagree, I'm not sure there's a "right" answer here. If I were to remove this behavior, there might be someone who is relying on it and files an issue asking me to change it back. I think I will err on the side of respecting the options that the Language Server Protocol provides. Edit: I suppose your suggestion (an option) would be the best of both worlds. If you are able, feel free to submit a PR. Otherwise I can get to it when I have time. |
Hey there, thanks so much for your work on this language server.
I'm using the latest v0.902 with v0.0.15 of the VS Code extension running over Remote SSH to a Ubuntu 22.04 server with Perl 5.36 installed via perlbrew. Everything works as expected except code formatting despite the fact that
perltidy
is installed and available in$PATH
. Running theFormat Document
command simply does nothing at all.When I switch to the perltidy extension for formatting, everything works correctly.
I've also attempted to specify my exact location of
.perltidyrc
and PLS still won't budge, while the perltidy extension I linked above works.I'm not entirely sure how to troubleshoot this to provide more information. Do you have any suggestions?
Thanks
Fotis
The text was updated successfully, but these errors were encountered: