forked from emacs-lsp/lsp-mode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlsp-intelephense.el
124 lines (99 loc) · 4.83 KB
/
lsp-intelephense.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
;;; lsp-intelephense.el --- LSP intelephense server configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Ivan Yonchovski
;; Author: Ivan Yonchovski <[email protected]>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'lsp-mode)
(defgroup lsp-intelephense nil
"Settings for pyls."
:group 'tools
:tag "PHP Language Server")
(defcustom lsp-intelephense-files-max-size 1000000
"Maximum file size in bytes."
:type 'number)
(defcustom lsp-intelephense-files-associations
["*.php" "*.phtml"]
"Configure glob patterns to make files available for language
server features."
:type '(repeat string))
(defcustom lsp-intelephense-files-exclude
["**/.git/**" "**/.svn/**" "**/.hg/**" "**/CVS/**" "**/.DS_Store/**"
"**/node_modules/**" "**/bower_components/**" "**/vendor/**/{Test,test,Tests,tests}/**"]
"Configure glob patterns to exclude certain files and folders from all language server features." :type
'(repeat string))
(defcustom lsp-intelephense-stubs
["apache" "bcmath" "bz2" "calendar"
"com_dotnet" "Core" "csprng" "ctype" "curl" "date" "dba" "dom" "enchant"
"exif" "fileinfo" "filter" "fpm" "ftp" "gd" "hash" "iconv" "imap" "interbase"
"intl" "json" "ldap" "libxml" "mbstring" "mcrypt" "mssql" "mysql" "mysqli"
"oci8" "odcb" "openssl" "password" "pcntl" "pcre" "PDO" "pdo_ibm" "pdo_mysql"
"pdo_pgsql" "pdo_sqlite" "pgsql" "Phar" "posix" "pspell" "readline" "recode"
"Reflection" "regex" "session" "shmop" "SimpleXML" "snmp" "soap" "sockets"
"sodium" "SPL" "sqlite3" "standard" "superglobals" "sybase" "sysvmsg"
"sysvsem" "sysvshm" "tidy" "tokenizer" "wddx" "xml" "xmlreader" "xmlrpc"
"xmlwriter" "Zend OPcache" "zip" "zlib"]
"Configure stub files for built in symbols and common
extensions. The default setting includes PHP core and all
bundled extensions."
:type '(repeat string))
(defcustom lsp-intelephense-completion-insert-use-declaration t
"Use declarations will be automatically inserted for namespaced
classes, traits, interfaces, functions, and constants."
:type 'boolean)
(defcustom lsp-intelephense-completion-fully-qualify-global-constants-and-functions nil
"Global namespace constants and functions will be fully
qualified (prefixed with a backslash)."
:type 'boolean)
(defcustom lsp-intelephense-format-enable t
"Enables formatting"
:type 'boolean)
(defcustom lsp-intelephense-trace-server "off"
"Traces the communication between VSCode and the intelephense
language server."
:type '(choice (:tag "off" "messages" "verbose")))
(defcustom lsp-intelephense-storage-path (locate-user-emacs-file "lsp-cache")
"Optional absolute path to storage dir."
:group 'lsp-php-ip
:type 'directory)
(lsp-register-custom-settings
'(("intelephense.trace.server" lsp-intelephense-trace-server)
("intelephense.format.enable" lsp-intelephense-format-enable t)
("intelephense.completion.fullyQualifyGlobalConstantsAndFunctions" lsp-intelephense-completion-fully-qualify-global-constants-and-functions t)
("intelephense.completion.insertUseDeclaration" lsp-intelephense-completion-insert-use-declaration t)
("intelephense.stubs" lsp-intelephense-stubs)
("intelephense.files.exclude" lsp-intelephense-files-exclude)
("intelephense.files.associations" lsp-intelephense-files-associations)
("intelephense.files.maxSize" lsp-intelephense-files-max-size)))
(defcustom lsp-clients-php-iph-server-command
`("intelephense" "--stdio")
"Install directory for php-language-server."
:group 'lsp-php-ip
:type '(repeat string))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection
(lambda () lsp-clients-php-iph-server-command))
:major-modes '(php-mode)
:priority -1
:notification-handlers (ht ("indexingStarted" #'ignore)
("indexingEnded" #'ignore))
:initialization-options (lambda ()
(list :storagePath lsp-intelephense-storage-path))
:multi-root t
:server-id 'iph))
(provide 'lsp-intelephense)
;;; lsp-intelephense.el ends here
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)
;; End: