Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
5c48da22
Commit
5c48da22
authored
Apr 26, 2019
by
di68kap
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- server.py: language server started
parent
c29315c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
DHParser/server.py
DHParser/server.py
+37
-0
No files found.
DHParser/server.py
View file @
5c48da22
...
...
@@ -342,6 +342,12 @@ class Server:
params
=
obj
[
'params'
]
if
'params'
in
obj
else
()
await
run
(
method_name
,
method
,
params
)
try
:
error
=
cast
(
Dict
[
str
,
str
],
result
[
'error'
])
rpc_error
=
error
[
'code'
],
error
[
'message'
]
except
TypeError
:
pass
# result is not a dictionary, never mind
if
rpc_error
is
None
:
json_result
=
{
"jsonrpc"
:
"2.0"
,
"result"
:
result
,
"id"
:
json_id
}
writer
.
write
(
json
.
dumps
(
json_result
,
cls
=
DHParser_JSONEncoder
).
encode
())
...
...
@@ -456,3 +462,34 @@ class Server:
while
self
.
server_messages
.
get
()
!=
SERVER_OFFLINE
:
pass
self
.
terminate_server
()
class
LanguageServer
(
Server
):
"""Template for the implementation of a language server.
See: https://microsoft.github.io/language-server-protocol/"""
cpu_bound
=
ALL_RPCs
# type: Set[str]
blocking
=
frozenset
()
# type: Set[str]
def
__init__
(
self
):
rpc_table
=
dict
()
# type: RPC_Table
for
attr
in
dir
(
self
):
if
attr
.
startswith
(
'rpc_'
):
name
=
attr
[
4
:].
replace
(
'_'
,
'/'
)
func
=
getattr
(
self
,
attr
)
rpc_table
[
name
]
=
func
super
().
__init__
(
rpc_table
,
self
.
cpu_bound
,
self
.
blocking
)
self
.
_initialized
=
False
def
rpc_initialize
(
self
,
processId
:
Optional
[
int
],
rootPath
:
Optional
[
str
],
rootUri
:
Optional
[
str
],
initializeOptions
:
JSON_Type
,
capabilities
:
JSON_Type
,
trace
:
str
,
workspaceFolders
:
List
[
Dict
[
str
,
str
]]):
if
self
.
_initialized
:
pass
# Error Code -32002
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment