forked from jupyter-lsp/yaml-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (36 loc) · 864 Bytes
/
main.py
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
import pathlib
import shutil
import subprocess
import sys
NODE_LOCATION = (
shutil.which("node") or
shutil.which("node.exe") or
shutil.which("node.cmd")
)
NODE = str(pathlib.Path(NODE_LOCATION).resolve())
PATH_TO_BIN_JS = str(
(
pathlib.Path(__file__).parent /
'node_modules' / 'yaml-language-server' /
'bin' / 'yaml-language-server'
).resolve()
)
def main():
p = subprocess.Popen(
[NODE, PATH_TO_BIN_JS, '--stdio', *sys.argv[1:]],
stdin=sys.stdin, stdout=sys.stdout
)
sys.exit(p.wait())
def load(app):
return {
"yaml-language-server": {
"version": 2,
"argv": ['yaml-lsp'],
"languages": ["yaml"],
"mime_types": [
"text/x-yaml", "text/yaml"
]
}
}
if __name__ == "__main__":
main()