PHP code validation

Kåre Särs kare.sars at mailbox.org
Tue Feb 13 09:47:38 GMT 2024


On tisdag 13 februari 2024 11:02:54 EET Marc Serra wrote:
> I have sung victory too soon :(
> 
> phpactor works for local files but no for sftp development [1]
> 
> I also tried the other Language Servers listed in
> https://langserver.org/, but not with optimal results...
> 
> php language server [2] -> requires php7.1 and my workstation and
> development must use php8.1
> serenata [3] ->  requires php7.1 and my workstation and development
> must use php8.1
> crane [4] -> seems discountinued (latest version is more than 7 years old)
> psalm [5] -> I cannot get it working to test it :(
> 
> Any ideas?
> 
> My requirements are not too complicated. I want to develop little PHP
> projects with kate with SSH (SFTP), code linting and code auto
> indentation.
>

The problem is probably that Language Server cannot access the files and 
environment where the files are on the remote server.

I think the easiest way to get that remote project running might be to mount 
the folder somehow. Like for example with "sshfs remote.server/path local/
path". That gives the local LS a chance to read the files.

/Kåre
 
> Thank's!
> 
> [1] https://github.com/phpactor/phpactor/discussions/2544
> [2] https://github.com/felixfbecker/php-language-server
> [3] https://gitlab.com/Serenata/Serenata
> [4] https://github.com/HvyIndustries/crane/tree/master/server
> [5] https://github.com/vimeo/psalm
> 
> Missatge de Marc Serra <mserra at manxa.com> del dia dt., 13 de febr.
> 
> 2024 a les 8:47:
> > Finally I got linting for PHP code on Kate working!
> > 
> > I installed phpactor [1] on my workstation and added this lines to
> > ~/.config/kate/Ispclient/settings.json
> > 
> > {
> > 
> >     "servers": {
> >     
> >         "php": {
> >         
> >             "command": ["phpactor", "language-server"],
> >             "rootIndicationFileNames": ["composer.json", "composer.lock"],
> >             "url": "https://github.com/phpactor/phpactor",
> >             "highlightingModeRegex": "^PHP.*$"
> >         
> >         }
> >    
> >    }
> > 
> > }
> > 
> > Thank's for your guidance and thank's to all Kate developers!
> > 
> > 
> > [1] https://github.com/phpactor/phpactor
> > 
> > 
> > Missatge de Marc Serra <mserra at manxa.com> del dia dl., 12 de febr.
> > 
> > 2024 a les 12:29:
> > > Thank's for your quick answer,
> > > 
> > > I'm new to LSP.
> > > 
> > > I can see some LSP servers on kate options, but not a default PHP
> > > server.
> > > 
> > > Is there some PHP LSP server online? line for bash ...
> > > 
> > > "bash": {
> > > 
> > > "command": ["bash-language-server", "start"],
> > > 
> > > "root": "",
> > > 
> > > "url": "https://github.com/bash-lsp/bash-language-server",
> > > 
> > > "highlightingModeRegex": "^Bash$"
> > > 
> > > }
> > > 
> > > 
> > > Or I must install a LSP PHP server on my own server?
> > > 
> > > 
> > > Thank's
> > > 
> > > Missatge de Waqar Ahmed <waqar.17a at gmail.com> del dia dl., 12 de febr. 
2024 a les 12:11:
> > >> If you use a php language server that supports linting php code, then
> > >> yes. We have a language server plugin that can be used for
> > >> intellisense and other helpful features. See: -
> > >> https://langserver.org/
> > >> -
> > >> https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspc
> > >> lient.html> >> 
> > >> On Mon, Feb 12, 2024 at 3:59 PM Marc Serra <mserra at manxa.com> wrote:
> > >>> Hi,
> > >>> 
> > >>> Kate supports code validation for PHP language?
> > >>> 
> > >>> For example, if I write:
> > >>> <?php
> > >>> echo "hello world;
> > >>> ?>
> > >>> 
> > >>> I want to kate show a message or mark the line with the error because
> > >>> there is a missing double quote.
> > >>> 
> > >>> Thank's






More information about the KWrite-Devel mailing list