Skip to content

Commit

Permalink
Added docs on running LS in a container
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Jul 23, 2023
1 parent ecfc9b7 commit 94cac0d
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions docs/running_psalm/language_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ It currently supports diagnostics (i.e. finding errors and warnings), go-to-defi

It works well in a variety of editors (listed alphabetically):

## Emacs
## Client configuration

### Emacs

I got it working with [eglot](https://github.com/joaotavora/eglot)

Expand All @@ -27,13 +29,13 @@ This is the config I used:
)
```

## PhpStorm
### PhpStorm

### Native Support
#### Native Support

As of PhpStorm 2020.3 support for psalm is supported and on by default, you can read more about that [here](https://www.jetbrains.com/help/phpstorm/using-psalm.html)

### With LSP
#### With LSP

Alternatively, psalm works with `gtache/intellij-lsp` plugin ([Jetbrains-approved version](https://plugins.jetbrains.com/plugin/10209-lsp-support), [latest version](https://github.com/gtache/intellij-lsp/releases/tag/v1.6.0)).

Expand All @@ -51,7 +53,7 @@ In the "Server definitions" tab you should add a definition for Psalm:

In the "Timeouts" tab you can adjust the initialization timeout. This is important if you have a large project. You should set the "Init" value to the number of milliseconds you allow Psalm to scan your entire project and your project's dependencies. For opening a couple of projects that use large PHP frameworks, on a high-end business laptop, try `240000` milliseconds for Init.

## Sublime Text
### Sublime Text

I use the excellent Sublime [LSP plugin](https://github.com/tomv564/LSP) with the following config(Package Settings > LSP > Settings):
```json
Expand All @@ -64,7 +66,7 @@ I use the excellent Sublime [LSP plugin](https://github.com/tomv564/LSP) with th
}
```

## Vim & Neovim
### Vim & Neovim

**ALE**

Expand Down Expand Up @@ -105,6 +107,15 @@ Add settings to `coc-settings.json`:
}
```

## VS Code
### VS Code

[Get the Psalm plugin here](https://marketplace.visualstudio.com/items?itemName=getpsalm.psalm-vscode-plugin) (Requires VS Code 1.26+):

## Running the server in a docker container

Make sure you use `--map-folder` option. Using it without argument will map the server's CWD to the host's project root folder. You can also specify a custom mapping. For example:
```bash
docker-compose exec php /usr/share/php/psalm/psalm-language-server \
-r=/var/www/html \
--map-folder=/var/www/html:$PWD
```

0 comments on commit 94cac0d

Please sign in to comment.