perl-language-server's People
Forkers
sztheory rabbiveesh kraih bscan janlimpens tjparnell kathackeray lsp-implementaions c-alpha jobindex worriy yanick gzqxperl-language-server's Issues
How to use Critic with custom policies?
I have a directory containing perlcritic policies, and have been trying to figure out how to get PLS to notify Critic of them. Looking at the PLS code, it seems there's nowhere that policies are added to Critic. Is there another way to do this? If not, an implementation would be much appreciated.
Hackathons in 2022
I am uncertain what the best contact is for perl-language-server so I just thought i would create an issue.
We in the perl marketing committee would like to get this project involved in an IDE Hackathon in 2022 (see https://news.perlfoundation.org/post/hackothon-events-planning-2022)
Please comment on the above post and/or jump in to the marketing channel on The Perl Foundations Slack instance (perlfoundation dot slack dot com)
Neovim documentation
Hello, I use PLS very successfully with Neovim and I'd like to document how I do it. Where would be the best place to add this?
I just recently had out-of-the-box support for PLS in Neovim included (neovim/nvim-lspconfig#1013).
Compilation aborted message in executable code
Hello there,
I'm facing a problem with running a full Mojo app.
The codeproblem window is telling me that the compilation aborted while the code can be executed.
This is my settings.json:
{
"workbench.colorTheme": "Default Dark+",
"editor.tabSize": 2,
"perl.perlcritic.enabled": false,
"perl.inc": [
"./lib",
"./t/lib",
],
"telemetry.enableTelemetry": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
This only appears while the sourcefile is opened.
Thanks for your work! I really like PLS :)
Diagnostics from closed files are sometimes not removed
Sometimes when a file was open and is closed, the diagnostics will not be cleared from VSCode's problems window.
I suspect it has something to do with out of order responses when a save and a close happen close to one another. I think running diagnostics is single threaded, but maybe that's not enough to ensure that requests are returned in order.
visible tempfiles while running on an nfs shared folder
PLS 0.895
It seems that PLS generates files which it keeps open and immediately deletes again ... on an nfs shared folder this has the effect of creating .nfs files ... this is nothing 'bad' but it is rather ugly ... I would rather like to see these things be generated /tmp or /run/shm as this is generally local or even in memory and above all out of sight ...
It also seems that all these different .nfs*
files are actually copies of the file I am currently working on ... and the fact that they are still around indicates that PLS is keeping them open ... and thus prevents their removal.
Workspace symbols not showing
I see that version 0.897 has workspace symbol support (thanks!). I upgraded to it, attempted to view workspace symbols, and nothing is returned. I assume I'm doing something wrong, any suggestions?
As I mentioned in another issue, I have no output logging for PLS (screenshot attached to show what I do have). I verified that PLS is running because when I disable it, the outline / symbols in file stop functioning, so I do know that PLS is working.
Thanks!
needs to use taint switch if used on the shebang line
just like vim-syntastic/syntastic#422
Perl complains if you edit a script with the following shebang line:
#!/usr/bin/perl -T
with the message:
"-T" is on the #! line, it must also be used on the command line at - line 1.
So, if these flags are present on the shebang line, PLS should invoke perl with -t
or -T
.
This is especially important because Perl will not go further than this and will not check for any other errors.
Setting the flag in the config does not work:
"perl.perlCmd": "perl -T",
[Error - 3:09:35 PM] Starting client failed
Launching server using command perl -T failed.
server: pls does not compile
I took the following steps to install the language server:
- Clone repository and switch to
server
directory. cpanm PPI PPR Perl::Critic Perl::Tidy
perl Makefile.PL && make install
This successfully installed the pls
executable and associated packages into my local lib. However, attempting to run pls
gives the following compile-time error:
syntax error at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 103, near "$column_number <"
Type of arg 1 to List::Util::first must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 106, near "@elements;"
syntax error at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 246, near "$column_number <="
Type of arg 1 to List::Util::any must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 447, near "->variables)
"
Type of arg 1 to List::Util::any must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 456, near "@variables)
"
Type of arg 1 to List::Util::first must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 484, near "->children;"
Type of arg 1 to List::Util::first must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 1008, near "@elements;"
Type of arg 1 to List::Util::first must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 1009, near "@elements;"
Type of arg 1 to List::Util::any must be block or sub {} (not reference constructor) at PATH/TO/LOCALLIB/perl5/PLS/Parser/Document.pm line 1186, near "@installed)
"
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS/Server/Response/Resolve.pm line 8.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS/Server/Response/Resolve.pm line 8.
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS/Server/Request/CompletionItem/Resolve.pm line 8.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS/Server/Request/CompletionItem/Resolve.pm line 8.
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS/Server/Method/CompletionItem.pm line 5.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS/Server/Method/CompletionItem.pm line 5.
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS/Server/Request/Factory.pm line 6.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS/Server/Request/Factory.pm line 6.
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS/Server.pm line 14.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS/Server.pm line 14.
Compilation failed in require at PATH/TO/LOCALLIB/perl5/PLS.pm line 5.
BEGIN failed--compilation aborted at PATH/TO/LOCALLIB/perl5/PLS.pm line 5.
Compilation failed in require at PATH/TO/LOCALBIN/pls line 12.
BEGIN failed--compilation aborted at PATH/TO/LOCALBIN/pls line 12.
This is with perl version 5.30.3, btw.
Constructing a IO::Async::Stream with an encoding-enabled handle may not read correctly
This problem is an environment problem, not a pls problem. Creating issue in case the workaround is useful for anybody seeing the same warnings.
I have a project that relies on PERL_UNICODE=SDA in the environment. (docs). This is equivalent to running perl -CSDA
Observing deprecation warnings related to PERL_UNICODE. This is accompanied by intermittent crashing of PLS within vscode. The warnings would be fatal in 5.30+
The warnings:
Constructing a IO::Async::Stream with an encoding-enabled handle may not read correctly at /home/username/perl5/perlbrew/perls/perl-5.26.3/lib/site_perl/username.26.3/PLS/Server.pm line 142.
sysread() is deprecated on :utf8 handles. This will be a fatal error in Perl 5.30 at /home/username/perl5/perlbrew/perls/perl-5.26.3/lib/5.26.3/x86_64-linux/IO/Handle.pm line 468, <DATA> line 1.
syswrite() is deprecated on :utf8 handles. This will be a fatal error in Perl 5.30 at /home/username/perl5/perlbrew/perls/perl-5.26.3/lib/5.26.3/x86_64-linux/IO/Handle.pm line 481, <DATA> line 1.
The deprecation warning is easily reproduced at the shell by running PERL_UNICODE=S pls
How this happens
- PLS::Server calls IO::Async::Stream->new_for_stdio()
- new_for_stdio() grabs *STDIN and *STDOUT
- PERL_UNICODE=S defaults those handles to binmode :utf8, havoc ensues
Workaround
Nullify the PERL_UNICODE environment variable when running PLS, by setting "perl.syntax.perl": "perl -C0"
Possibility to configure subdirectories that will be ignored by PLS
Hi, I do have some directories in my project where perl files are copied to during testing. They are hidden from VSCode (using "files.exclude" option in .vscode/settings.json) and github (using .gitignore). However PLS scans them, and shows e.g. their content when choosing "go to definition" (See screenshot).
It would be nice to have a configuration option to hide certain directories also from PLS.
Additionally there could be an option to respect the "files.exclude" option and .gitignore also for PLS.
Provide instructions on how to use PLS inside a container
After seeing #36, I'm trying to make the vscode extension work with PLS installed inside a container where I have other libraries my application uses, but I have no success at all.
What I've tried so far:
- Installed PLS inside a container with
RUN cpanm PLS
. - Added to
settings.json
:
"perl.pls": "docker",
"perl.plsargs": ["exec", "-ti", "PLS", "pls"],
- Ran the container with
docker run --rm -ti --name PLS perl-languageserver /bin/bash
- Opened the project in vscode.
Output in vscode:
[Info - 4:48:47 PM] Connection to server got closed. Server will restart.
the input device is not a TTY
the input device is not a TTY
[Info - 4:48:47 PM] Connection to server got closed. Server will restart.
the input device is not a TTY
[Info - 4:48:47 PM] Connection to server got closed. Server will restart.
the input device is not a TTY
[Info - 4:48:47 PM] Connection to server got closed. Server will restart.
the input device is not a TTY
[Error - 4:48:47 PM] Connection to server got closed. Server will not be restarted.
I also tried the run
command in perl.plsargs
with the same results. What am I missing here?
Perl::Tidy will use -eos by default
Steven Hancock, Perl::Tidy maintainer, sent this to me in an email:
I am the author of Perl::Tidy and am writing about an upcoming change in a default setting and want to be sure it does not cause problems for modules which use Perl::Tidy. The issue involves changing the default setting of a flag -eos in order to make perltidy behave better when used as a filter. I've put a document on github which describes the issue:
https://github.com/perltidy/perltidy/blob/master/docs/eos_flag.md
I plan to make this change sometime later this year, possibly this summer, and want to be sure that it doesn't cause data corruption for any existing modules. I have looked through all modules on CPAN which use Perl::Tidy, and found that most will not have a problem, but for a couple, including PLS, I wasn't sure and need help in checking.
One way to check for problems would be to run PLS on the current CPAN release of Perl::Tidy with -eos set, using files with wide characters.
Another way to check would be to install tagged version 20220217.02 at
https://github.com/perltidy/perltidy/releases/tag/20220217.02
which is basically the same as the latest CPAN release but which has -eos set as the default.
If problems occur (i.e. double encoding of text with wide characters), then a fix such as discussed in the above document could be made.
Please contact me if you have any questions.
Question about autocomplete
Hi, I am not confident that these issues due to bugs on the pls side.
In general, I have got a little perl script, which will be below. I encountered with couple strange issues. I enumerate them in order.
- It doesn't work the autocomplete for LWP::Useragent package. I don't realize why, because I pointed the inc option e.g
inc = {'/usr/share/perl5/core_perl','/usr/share/perl5/vendor_perl/CPAN', '/usr/share/perl5/site_perl'},
- It doesn't work the autocomplete for following code when I type
$bot->
, but work forHTTP::tiny->
my $url=$ARGV[0];
my $bot=HTTP::Tiny->new();
$bot->agent("simple bot");
my $resp=$bot->get($url);
$resp->{content} =~ q|<title>(.*?)</title>|;
print "$ARGV[0]| title -> $1";
Trouble getting perlcriticrc to work for linting in Neovim
Hello, I'm having a hard time getting linting to work with perlcriticrc and any pointers would be appreciated. With my current setup, I'm at least getting Perl autocomplete suggestions, so I know I'm almost there.
My Neovim config looks like:
├── init.lua
├── lua
│ └── user
│ ├── alpha.lua
│ ├── autocommands.lua
│ ├── autopairs.lua
│ ├── bufferline.lua
│ ├── cmp.lua
│ ├── colorscheme.lua
│ ├── comment.lua
│ ├── gitsigns.lua
│ ├── icons.lua
│ ├── impatient.lua
│ ├── indentline.lua
│ ├── keymaps.lua
│ ├── lsp
│ │ ├── handlers.lua
│ │ ├── init.lua
│ │ ├── lsp-installer.lua
│ │ ├── null-ls.lua
│ │ ├── perlpls.lua
│ │ └── settings
│ │ ├── jsonls.lua
│ │ └── sumneko_lua.lua
│ ├── lualine.lua
│ ├── nvim-tree.lua
│ ├── options.lua
│ ├── plugins.lua
│ ├── project.lua
│ ├── telescope.lua
│ ├── toggleterm.lua
│ ├── treesitter.lua
│ └── whichkey.lua
└── plugin
└── packer_compiled.lua
The init.lua file in the top directory requires the lsp directory which contains an init.lua file. That init.lua file looks like this:
It requires the user.lsp.perlpls file which has this for content:
Per the perl-language-server documentation, I installed the PLS, using the information at this link and ran cpanm PLS
to install it.
Note, for all other language servers, I installed them using the nvim-lsp-installer, but unfortunately it doesn't support Perl.
My hope is that with Perl linting, I'll be able to get behavior like I have with Python, including goto definition, hover, etc.
Cached file name? and perl critic
Hi I have a file that I originally created with a case type error in the name, it was supposed to be DateAndTime.pm
but instead I wrote it with lowercase t
in time as DateAndtime.pm
.
For certain reson the original filename is passed from VSCode to pls and perl critic, and since the package points to the correct class name (with capital T
) it complains about the difference in the package and the file.
I already tried to reload VSCode, close and re-open VSCode, rename the file (to something different) and then restore it, but at the end it will keep using the original filename to send it to pls. Also removed .pls_cache.
I guess this comes from some sort of cache, do you know how can I fix this?
This is the current name (correct)
This is the current package class (correct)
And this is the problems widget (where you can see that is using the original name instead)
For sure If I call the perl critic directly from the CLI it works correctly.
Move away from Coro and AnyEvent
Coro and AnyEvent apparently don't have great support in newer versions of Perl.
We can probably use IO::Async and Futures instead of Coro.
- For request handling, that can all probably happen in Futures, spun off by an IO::Async::Stream
- For indexing, which happens completely asynchronously and in the "background", we can probably use IO::Async::Function.
- You can apparently get the IO::Async::Loop anywhere in the program magically by calling its constructor.
'method' keyword from Function::Parameters
Hi FractalBoy,
I'm looking for a way to support the method
keyword from Function::Parameters
.
Since it's not a Perl Keyword, its not supported?
At least that is my conclusion because of the highlighting:
I am currently not able to apply a patch for this myself.
The only thing I can provide is a "community-beneficial" reason:
The codebase is used in an educational environment, thus a lot of young programmers get exposed to the language for the first time.
I chose Function::Parameters
, to lower the entry barrier for students, because the code becomes more similar to other languages.
This is also the reason, why I am looking into PLS
: giving the students a pleasant "modern" Perl experience.
Thanks for any helpful hint.
I can't tell how much work it would be to support a method
keyword. It would probably just be parallel to the sub
keyword?
It may also be questionable to include non standard syntax..?
Anyways, thanks a lot for PLS
.
goto defintion not working with ampersand prefix
Using tag 0.897, goto definition works on subroutine calls that are not prefixed with an ampersand:
[DEBUG][2022-05-12 20:04:07] .../lua/vim/lsp.lua:1023 "LSP[perlpls]" "client.request" 1 "textDocument/definition" { position = { character = 0, line = 25 }, textDocument = { uri = "file:///home/blah/lib/perl/perl_test.pl" }} <function 1> 1 [DEBUG][2022-05-12 20:04:07] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 2, jsonrpc = "2.0", method = "textDocument/definition", params = { position = { character = 0, line = 25 }, textDocument = { uri = "file:///home/blah/lib/perl/perl_test.pl" } }} [DEBUG][2022-05-12 20:04:07] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 2, jsonrpc = "2.0", result = { range = { end = { character = 28, line = 16 }, start = { character = 0, line = 13 } }, uri = "file:///home/blah/lib/perl/perl_test.pl" }}
However, if the call is prefixed with an ampersand:
[DEBUG][2022-05-12 20:05:23] .../lua/vim/lsp.lua:1023 "LSP[perlpls]" "client.request" 1 "textDocument/definition" { position = { character = 4, line = 15 }, textDocument = { uri = "file:///home/blah/lib/perl/perl_test.pl" }} <function 1> 1 [DEBUG][2022-05-12 20:05:23] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 3, jsonrpc = "2.0", method = "textDocument/definition", params = { position = { character = 4, line = 15 }, textDocument = { uri = "file:///home/blah/lib/perl/perl_test.pl" } }} [DEBUG][2022-05-12 20:05:23] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 3, jsonrpc = "2.0"} [INFO][2022-05-12 20:05:23] ...lsp/handlers.lua:323 "textDocument/definition" "No location found"
I'm not an expert on nvim's LSP interface, but it seems like the debugging statements show the communication between the server and client is fine; it seems to be the server not parsing the text under the cursor correctly.
Crash in vscode without a workspace
Problem
When opening a perl file without having any defined workspace or workplace folders, PLS crashes.
Steps to reproduce
# Create an empty perl file
touch test.pl
# Without vscode already running, open test.pl with vscode
code test.pl
Extension crashes with this error:
Can't locate object method "file" via package "URI::_generic" at /Users/mjac/perl5/perlbrew/perls/perl-5.34.0/lib/site_perl/5.34.0/PLS/Server/Request/Initialize.pm line 36, line 1.
My environment:
M1 macOS 11.3.1
Perl version: 5.34.0
PLS Version: 0.88
PLS VSCode extension version: 0.0.9
Vscode version: 1.58.2
Workaround
This can be worked around by opening the enclosing folder of the file you want to edit instead of the file itself code ./
instead of code test.pl
Discussion
The issue is in this code within PLS::Server::Request::Initialize
my $root_uri = $self->{params}{rootUri};
my $path = URI->new($root_uri);
$PLS::Server::State::ROOT_PATH = $path->file;
my $index = PLS::Parser::Index->new(root => $path->file);
$self->{params}{rootUri}
is undef when opening files without a workspace folder open. You can see the same error message with this code, basically reproducing the same situation:
use URI;
my $bork = URI->new(undef);
print $bork->file;
I assume rootUri should be provided as the CWD of the opened file, e.g. file:///Users/mjac
I dug around into the $self->{params}
data structure, but didn't see anything that looked like a usable path to substitute when rootUri is undef.
Error when formatting document or selection with only PLS extension enabled in VSCode
VSCode for Windows 1.57.1
WSL2 with Fedora 34 connecting with Remote: WSL in VSCode
❯ perltidy -v
This is perltidy, v20210625
Copyright 2000-2021, Steve Hancock
Perltidy is free software and may be copied under the terms of the GNU
General Public License, which is included in the distribution files.
Complete documentation for perltidy can be found using 'man perltidy'
or on the internet at http://perltidy.sourceforge.net.
{
"[perl]": {
"editor.defaultFormatter": "FractalBoy.pls"
},
"perl.syntax.perl": "perl",
"perl.perlcritic.perlcriticrc": "~/.perlcriticrc",
"perl.perltidyrc": "~/.perltidyrc",
"perl.inc": [
"/home/dkl/perl5"
]
}
I am getting the error in PLS output tab when using Control-Shift-P -> Format Document or Format Selection
[Error - 2:33:01 PM] Request textDocument/formatting failed.
Message: Perltidy failed to format the text.
Code: -32700
You may not specify a destination array and -st together
(-pbp contains -st; see manual)
Additional Log output:
[2021-07-06 14:39:47.122] [exthost] [info] ExtensionService#_doActivateExtension FractalBoy.pls {"startup":false,"extensionId":{"value":"FractalBoy.pls","_lower":"fractalboy.pls"},"activationEvent":"onLanguage:perl"}
...
[2021-07-06 14:39:54.544] [exthost] [error] [FractalBoy.pls] provider FAILED
[2021-07-06 14:39:54.544] [exthost] [error] Error: Perltidy failed to format the text.
at /home/dkl/.vscode-server/extensions/fractalboy.pls-0.0.9/out/extension.js:1:30349
at /home/dkl/.vscode-server/extensions/fractalboy.pls-0.0.9/out/extension.js:1:30643
at Immediate.<anonymous> (/home/dkl/.vscode-server/extensions/fractalboy.pls-0.0.9/out/extension.js:1:31006)
at processImmediate (internal/timers.js:461:21)
[2021-07-06 14:40:01.209] [exthost] [warning] TextEditor is closed/disposed
Any idea what could be happening? I acan use the perltidy extension along side this one but I would love to be able to just have the one Perl extension to handle what I need.
Let me know if I can give more details.
Implement support for workspace folders
I can confirm that the extension is working as PerlCritic, PerlTidy, Outline and Syntax check are working correctly and without issues. but for me Go to definition is not really working for me in VSCode...
I always get something similar to No definition found for 'Foo'
.
I'm not sure how can I help to debug, but I will be happy to follow any instructions and or provide any needed configuration o information.
((enjoy))
cr
PLS doesn't want to install with 5.34
A freshly brewed 5.34:
davez@DAVIDs-MacBook-Pro selenium-tests % cpanm PLS
--> Working on PLS
Fetching http://www.cpan.org/authors/id/M/MR/MREISNER/PLS-0.7.tar.gz ... OK
Configuring PLS-0.7 ... OK
Needs perl 5.032, you have 5.030002
! Installing the dependencies failed: Your Perl (5.030002) is not in the range '5.032'
! Bailing out the installation for PLS-0.7.
davez@DAVIDs-MacBook-Pro selenium-tests % perl -v
This is perl 5, version 34, subversion 0 (v5.34.0) built for darwin-2level
Changing .perltidyrc requires reload to take effect
For some reason, when .perltidyrc is changed, it requires a reload for the change to take effect.
It's unclear if this is a bug in PLS or in Perl::Tidy. If it is a bug in Perl::Tidy, we might need to start a new process to run perltidy so that the config is not retained in memory.
Option to allow for running of perlimports
For reference:
perlimports: https://metacpan.org/dist/App-perlimports
video about it: https://youtu.be/fKqxdTbGxYY
One thing I really like about programming in Go is that gopls can be configured to run goimports. This automatically adds imports being used to the import section (and also sorts and organizes imports). perlimports can do something very similar for perl as goimports does for Go.
I realize you already have module sorting so maybe this will interfere with your tastes there, but the ability to automatically clean up and 'use' (or remove an unused 'use'), to me, can be a real time saver.
I'm proposing an option, similar to how perltidy integration works, that allows for the running of perlimports.
client: vsix pacakge doesn't contain build output
Loading the extension in VS Code results in the following log entry from the Extension Host:
[2021-06-24 09:10:58.410] [exthost] [error] Activating extension FractalBoy.pls failed due to an error:
[2021-06-24 09:10:58.410] [exthost] [error] Error: Cannot find module '/home/ctauxe/.vscode/extensions/fractalboy.pls-0.0.5/out/extension'
On closer inspection, I realized that the packaged extension, pls-0.0.5.vsix
only contains the files package.json
and README.md
in its extension directory.
Here are the steps I took when building the client extension:
- Clone repository and switch to
client
directory. npm install
vsce package
(I also tried installing packages through npm instead of yarn and using the--no-yarn
flag for vsce, but same result).
Below is the output of vsce ls --no-yarn
, also demonstrating that it only considers the pacakge.json
and README.md
files.
$ vsce ls --no-yarn
Executing prepublish script 'npm run vscode:prepublish'...
> [email protected] vscode:prepublish
> webpack --mode production
asset extension.js 255 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 931 bytes 4 modules
modules by path ./node_modules/ 648 KiB
modules by path ./node_modules/vscode-languageclient/ 337 KiB 75 modules
modules by path ./node_modules/vscode-languageserver-protocol/ 79.5 KiB 22 modules
modules by path ./node_modules/vscode-jsonrpc/ 118 KiB 16 modules
modules by path ./node_modules/yallist/*.js 8.42 KiB
./node_modules/yallist/yallist.js 8.21 KiB [built] [code generated]
./node_modules/yallist/iterator.js 207 bytes [built] [code generated]
9 modules
webpack 5.1.0 compiled successfully in 5678 ms
package.json
README.md
Add support for workspace indexing
The code base I'm working in has a fairly large library of modules. There are times where I know the name of the method I'm looking for, but I don't recall exactly which module it is located in. If the workspace were indexed, VSCode's "Goto symbol in workspace" would allow for this functionality. I've tried using Perl::LanguageServer and it seems to work, but it's annoyingly not case sensitive. Would it be possible to add a better supported version of this to PLS?
allow use of a different perl for syntax checking
PLS forks a perl process for syntax checking, so a different perl installation/version could potentially be used.
Probably just need to implement something like perl.perl
as a configuration item and use that instead of $^X
when syntax checking, if it is configured.
This would allow PLS to continue to require new versions of Perl, but allow syntax checking of a project on an older version.
Loading of user snippets in VSCode after file opening is not working
Hey there,
thanks a lot for this really nice VSCode extension, I love it! There is only one point which I dislike a lot:
- I'm opening up one single directory (a repository) in VSCode.
- I'm jumping to one specific line in my code and start to type a defined shortcut of a user snippet I do have.
- As usual, I expected that my user snippet is working fine, but currently it's not.
- I have to wait several seconds, maybe up to 30s, to have everything "loaded" and running fine (the snippet is working then).
Any idea what is going on there? If I'm going to disable the extensions, my user snippets are loaded without any delay.
Please, let me know if I could help with this.
Thanks!
Flo
Use a prefix for temporary directories
PLS creates temporary directories in the same place where the original files reside, see screenshot.
I would like to hide them in visual studio code using the files.exclude
option (see screenshot)
However it is not possible to define a suitable pattern with the current way the directory names are generated, e.g. '.*' would also match legitimate files such as '.vscode', '.travis.yml', '.perltidyrc'.
If all directory names would use a prefix such as '.pls_', it would be easy to define a pattern to exclude files.
Couldn't start client Perl Language Server (PLS)
I got this message after instaling the plugin on VS Code - Windows 10
(PLS v 0.88 installed)
Details:
[Error - 8:20:13] Starting client failed
Launching server using command pls failed.
WSL 2 support
Hello and thanks for making this extension/module
I have installed the PLS module to my WSL2 Ubuntu 20.04 without issues.
Although when I open a simple .pl file the output of the PLS says error
without any specific message on what goes wrong.
Do you know what may have caused this output?
Publish to open-vsx.org?
Thanks a lot for creating the perl language server, I'm a very happy customer on my local machine!
I am currently looking into providing a gitpod configuration for a perl project and would like to preinstall your extension there. Unfortunately, gitpod can only work with extensions published to open-vsx.org.
Would it be possible to publish your extension there as well? The actual process is rather simple: https://github.com/eclipse/openvsx/wiki/Publishing-Extensions (it really looks like more than it actually is). You (or I) can also submit your extension to https://github.com/open-vsx/publish-extensions and then your extension will be published automatically (however they consider that repo only a temporary workaround, so self publishing is the preferred process).
Listing subroutines of modules
Hello, I've been enjoying your language server for quite some time now and I was wondering if you could extend the functionality of the documentation view (of a certain module while mouse hovering) to show a list with all the subroutines this module can provide or class enroll inheritance etc. I think this could be implemented using the Data::Printer
module. This module seems very powerful and can export a lot of information in various formats and to various buffers even in memory.
Example:
$ reply
$res[0] = "less -R"
0> PLS::Server->new();
$res[1] = PLS::Server {
public methods (14):
handle_client_message, handle_client_request, handle_client_response, handle_server_request, handle_server_response, new, run, send_message, send_server_request
JSON::PP:
decode_json, encode_json, from_json, to_json
Scalar::Util:
blessed
private methods (0)
internals: {
loop IO::Async::Loop::Poll,
pending_requests {},
running_futures {},
stream undef
}
}
What do you think, is it something that could be done easily?
Can't locate object method "file" via package "URI::_generic"
Error while launching PLS server
Hello
I am getting this error since this morning on my VM on which I connect by using the Remote - SSH
extension.
[Error - 9:16:18 AM] Starting client failed
Launching server using command pls failed.
VS Code ver. 1.62.1
Remote - SSH ver. 0.66.1
Can you please verify if you are having the same issue?
Thanks for your time and effort.
Syntax Checking after code input
Is there a way to link syntax checking not only with autosafe but short time after code input?
Trouble with Catalyst style method attributes
We seem to have trouble parsing methods when there's a Catalyst style attribute. For example this works fine
sub test :Action ($self, $c) {
$c->session(ttt=>111);
}
But this doesn't
sub root :Chained(/root) PathPart(register) Args(0) Does(Verbs) ($self, $c) {
$c->redirect_to_action('#home') if $c->user;
}
I think whatever the parser is for method attributes it seems to balk when it hits one that is parameterized ( like :Chained(parameter) ). I 'think' this should be an easy fix, its probably just a small regular expression change someplace but I have not idea where to start :). I'm happy to work on a PR for this but if you could give me a pointer I'd be grateful.
Thanks!
Please add your .vscode folder
I was going to look at the Windows issue, but found this repo not have the .vscode dir and can't build the extension. Other extensions has .vscode in their repo, see,
https://github.com/microsoft/vscode-cpptools/tree/main/Extension
https://github.com/microsoft/vscode-python
Severity 1 issues do not show up in the PROBLEMS window.
Specifically, ValuesAndExpressions::ProhibitInterpolationOfLiterals is flagged as expected in the source file, but does not show up in the PROBLEMS window or the list of warnings.
As the flagging in the source is only under the initial quote character, it's very easy to miss. It would be helpful to have an option for severity 1 issues to be treated as warnings so they're not overlooked.
Perltidy defaults to `-et` when tabs are enabled instead of `-t`
Long story short, despite the documentation recommending -et
over -t
, -et
is basically broken:
perltidy/perltidy#90
If you want sane indentation using tabs, use -t
instead.
How do I get diagnostics working?
I'm new to LSPs so forgive the basic question. But I recently configured a working LSP (called "intelephense") with php and it provides helpful real time diagnostics by running the code through a compiler in the background. For example, if I leave off a semicolon or forget to us my
declaration I'd like to have a real-time flag raised. I have perlcritic installed and working. While that is throwing up errors, it doesn't catch compile time errors.
I'm running neovim 0.6.1 with the nvim-lspconfig plugin.
Add license to the VSCode extension
Now it has not a license https://marketplace.visualstudio.com/items?itemName=FractalBoy.pls
Could you please add a license like other extensions in VSCode marketplace do?
PLS stops responding in vscode
I've gotten PLS up and running in a WSL Ubuntu image and things seem to be working perfectly fine at first. Unfortunately, it just stops working after a while. Under the "Outline" section I just see a message saying "loading symbols" (or something of that sort), also, any previously open files that were working are now not, and display the same message.
In my (limited) testing, it coincidentally appears to be related whatever indexing VS Code does when it is first launched. As I mentioned, we have a fairly large library, and when VS Code tries to index the files in the workspace, it takes a decent chunk of time (it's one of the reasons I've still stick with Sublime, it handles that indexing differently). The delay is most likely because it's a remote mount via SSHFS (we can't use the Remote-SSH extension because the hosts are too old to support it). I say all this because while the indexing of those files is happening, the "Go To File" option doesn't really return any results. During this time, any files I manually open via the file tree are able to have their symbols identified. However, after a bit, I notice that the indexing finished and I am able to make use of "Go to file", which appears to be when the symbols stop working. I don't know that the two events are actually related, it seemed to happen around the same time.
extension does not accept command args
The extension only takes a command (perl.pls
) but does not take any arguments.
A new configuration item (perl.plsargs
?) should be added to allow passing additional arguments to the executable in perl.pls
.
This would allow configuration such as:
{
"perl.pls": "docker",
"perl.plsargs": ["exec", "-it", "<container name>", "pls"]
}
Issues with certain directories
Hi @FractalBoy,
This might be related to #82...
-
[2022-02-13 23:42:26] Indexing /Users/carlos/Library/Application Support/xbar/plugins/crcmdtools/lib/BaseCommand.pm...
With this file everything works well, Syntax, Perl Critic, Symbols, etc. -
[2022-02-13 23:43:38] Indexing /Users/carlos/Library/Application Support/xbar/plugins/crcmdtools/lib/Commands/MAS.pm...
But this file only shows symbols... syntax errors, perl critic, perl tidy are totally missing, I was not able to catch any errors in VS code logs.
My workspace configuration looks as follows...
{
"folders": [
{
"path": "/Users/carlos/Library/Application Support/xbar/plugins"
},
],
"settings": {
"perl.inc": [
"/Users/carlos/Library/Application Support/xbar/plugins/crcmdtools/lib"
],
}
}
Im not sure if the space in Application Support
could be the culprit.
Just to mention in other directories even much more nested but without spaces in the path works well with syntax, critic and tidy.
definition retrieval doesn't always retrieve definition of entire symbol
If I have something like this in my code:
use A::B::C::D::E;
If a textDocument/definition is sent to PLS with position.character = 7 and the line being whatever line the above is on, PLS will attempt to retrieve the definition for A::B. If it exists it will show A::B. if not, nothing happens. If the position.character is 10 ('C') a similar thing will happen for A::B::C. If instead a textDocument/definition is sent to PLS with position.character = 16 ('E') the definition for A::B::C::D::E will be retrieved if it can be found.
Should it not always attempt to retrieve A::B::C::D::E regardless of what the position.character value is (assuming the character falls between 'A' and 'E')?
I've noticed this with different code bases so I don't think it's specific to my setup.
PLS: 0.898
Perl: 5.34.0
revisit BBEdit compatibility
First of all, thank you for this project. It looks quite capable. I would love to get this to work with BBEdit following their support notes.
I know @mixio opened pull request #66 and I've pulled that code and updated it to your current base. While the simple JJ logger in the PR certainly doesn't need to be in the final merge, it was actually quite useful in sorting out the traffic between client and server when comparing between BBEdit and Visual Studio Code. I'm attaching two logs from each (I've cleaned up the JSON for ease of visibility). The biggest difference is where and how the client is sending PLS specific configuration.
Based on BBEdit's recommendations for advanced configurations, I'm putting the PLS JSON configuration into a provided directory for initializationOptions
, and this gets included in the initial client request. VSC, on the other hand, sends its PLS configuration under a completely separate, unlabeled request after server initialization and client acknowledgment.
Is there a way for PLS to process its configuration from the initial client request under initializationOptions
? I've tried putting the PLS configuration under different JSON keys, but PLS is not recognizing anything. It doesn't appear that BBEdit has any mechanism for sending a second request with the PLS configuration.
PLS client stopps working after VSCode update to 1.64
Hello,
i've recently updated VSCode to January version 1.64, which resulted in errors regarding the PLS extension.
Error messages after start are:
[Error - 17:46:00] Starting client failed
Launching server using command pls failed.
Obviously there are changes to the language server protocol introduced, please see the release notes
Unfortunately also removing the caches from my workspaces and restarting the machine didn't help here.
To me it seems, it has something to do with the client code (not the perl server), as it keeps working in an older release.
I'm currently using VSCode with PLS on two Arch Linux machines, where one works (VSCode 1.63) and the other doesn't (1.64).
Thanks in advance for your help!
Cheers
Marco
sorting imports issue
Sorting imports doesn't seem to work correctly for me.
If there is a blank line or comment it stops processing anything after the comment or blank line. It also doesn't seem to be sorting things alphabetically properly.
I see you are using ExtUtils::Installed to see what modules are installed. Sadly this doesn't really work for centos and ubuntu based systems and the likes because they don't include the .packlist in their rpm/dep packages. I only have packlists on my system for stuff I've installed out of cpan.
I'd either make using ExtUtils::Installed optional or remove it. I don't think it's gonna do a whole lot for most people. I don't know of any other better solutions. Maybe examine what's in @inc ? I think that's what https://github.com/briandfoy/app-module-lister does.
Personally I don't care for the spacing between the sections. I'd like to see an option to disable/enable spacing between sections.
What are your thoughts?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.