1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 12:50:04 +08:00

docs(php): update doc of lang#php layer

This commit is contained in:
wsdjeg 2022-04-13 17:46:41 +08:00
parent 918623d31f
commit dc01a27d4a
3 changed files with 95 additions and 13 deletions

View File

@ -28,9 +28,10 @@
"
" @subsection Key bindings
" >
" Mode Key Function
" ---------------------------------------------
" normal SPC l r run current file
" Key Function
" --------------------------------
" SPC l r run current file
" g d jump to definition
" <
"
" This layer also provides REPL support for php, the key bindings are:
@ -43,6 +44,22 @@
" SPC l s s send selection text
" <
"
" If the lsp layer is enabled for php, the following key bindings can
" be used:
" >
" key binding Description
" --------------------------------
" g D jump to type definition
" SPC l e rename symbol
" SPC l x show references
" SPC l h show line diagnostics
" SPC l d show document
" K show document
" SPC l w l list workspace folder
" SPC l w a add workspace folder
" SPC l w r remove workspace folder
" <
"
if exists('s:php_interpreter')
finish
@ -105,12 +122,26 @@ endfunction
function! s:on_ft() abort
if SpaceVim#layers#lsp#check_filetype('php')
\ || SpaceVim#layers#lsp#check_server('phpactor')
\ || SpaceVim#layers#lsp#check_server('intelephense')
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
nnoremap <silent><buffer> gD :<C-u>call SpaceVim#lsp#go_to_typedef()<Cr>
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
\ 'call SpaceVim#lsp#show_doc()', 'show-document', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'x'],
\ 'call SpaceVim#lsp#references()', 'show-references', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
\ 'call SpaceVim#lsp#rename()', 'rename-symbol', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'h'],
\ 'call SpaceVim#lsp#show_line_diagnostics()', 'show-line-diagnostics', 1)
let g:_spacevim_mappings_space.l.w = {'name' : '+Workspace'}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'l'],
\ 'call SpaceVim#lsp#list_workspace_folder()', 'list-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'a'],
\ 'call SpaceVim#lsp#add_workspace_folder()', 'add-workspace-folder', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'w', 'r'],
\ 'call SpaceVim#lsp#remove_workspace_folder()', 'remove-workspace-folder', 1)
endif
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
\ 'call SpaceVim#plugins#runner#open()',

View File

@ -3946,9 +3946,10 @@ LAYER OPTIONS
KEY BINDINGS
>
Mode Key Function
---------------------------------------------
normal SPC l r run current file
Key Function
--------------------------------
SPC l r run current file
g d jump to definition
<
This layer also provides REPL support for php, the key bindings are:
@ -3961,6 +3962,21 @@ This layer also provides REPL support for php, the key bindings are:
SPC l s s send selection text
<
If the lsp layer is enabled for php, the following key bindings can be used:
>
key binding Description
--------------------------------
g D jump to type definition
SPC l e rename symbol
SPC l x show references
SPC l h show line diagnostics
SPC l d show document
K show document
SPC l w l list workspace folder
SPC l w a add workspace folder
SPC l w r remove workspace folder
<
==============================================================================
LANG#PLANTUML *SpaceVim-layers-lang-plantuml*

View File

@ -8,13 +8,15 @@ description: "PHP language support, including code completion, syntax lint and c
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Features](#features)
- [Install](#install)
- [Installation](#installation)
- [Enable language layer](#enable-language-layer)
- [Language tools](#language-tools)
- [Layer options](#layer-options)
- [Key bindings](#key-bindings)
- [Jump to definition](#jump-to-definition)
- [Running current script](#running-current-script)
- [Inferior REPL process](#inferior-repl-process)
- [LSP key Bindings](#lsp-key-bindings)
<!-- vim-markdown-toc -->
@ -22,8 +24,6 @@ description: "PHP language support, including code completion, syntax lint and c
`lang#php` layer provides PHP language support in SpaceVim.
## Features
- code completion (`autocomplete` layer)
- code formatting (`format` layer)
- syntax checking (`checkers` layer)
@ -31,7 +31,9 @@ description: "PHP language support, including code completion, syntax lint and c
- reference finder (`gtags` layer)
- language server protocol support (`lsp` layer)
## Install
## Installation
### Enable language layer
This layer is not enabled by default. To use this layer, you need to add following
snippet into SpaceVim configuration file:
@ -40,6 +42,23 @@ snippet into SpaceVim configuration file:
[[layers]]
name = "lang#php"
```
### Language tools
- **language server**
To enable php support of `lsp` layer. You may need to install `intelephense`:
```
npm install -g intelephense
```
Also you need enable `lsp` layer with intelephense client:
```
[[layers]]
name = 'lsp'
enabled_clients = ['intelephense']
```
## Layer options
@ -70,3 +89,19 @@ Send code to inferior process commands:
| `SPC l s l` | send line and keep code buffer focused |
| `SPC l s s` | send selection text and keep code buffer focused |
### LSP key Bindings
If the lsp layer is enabled for php, the following key bindings can
be used:
| key binding | Description |
| ----------- | ----------------------- |
| `g D` | jump to type definition |
| `SPC l e` | rename symbol |
| `SPC l x` | show references |
| `SPC l s` | show line diagnostics |
| `SPC l d` | show document |
| `K` | show document |
| `SPC l w l` | list workspace folder |
| `SPC l w a` | add workspace folder |
| `SPC l w r` | remove workspace folder |