This repository has been archived by the owner on Mar 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on ability for server to send commands
- Loading branch information
TJ DeVries
committed
Nov 18, 2016
1 parent
cf7cf98
commit 9eb9c8d
Showing
5 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Command handler | ||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
|
||
function! langserver#extension#command#callback(id, data, event) abort | ||
call langserver#log#server_request(a:id, a:data, a:event) | ||
|
||
if type(a:data) != type({}) | ||
return | ||
endif | ||
|
||
let l:method = a:data.request.method | ||
|
||
if l:method ==? 'fs/readFile' | ||
let l:response = langserver#extension#fs#readFille(a:data.request.params) | ||
else | ||
call langserver#log#log('warning', 'No matching callback found for: ' . l:method) | ||
return v:false | ||
endif | ||
|
||
call langserver#client#send(a:id, { | ||
\ 'req_id': a:data.request.id, | ||
\ 'method': 'fs/readFile', | ||
\ 'params': { | ||
\ 'result': l:response, | ||
\ }, | ||
\ }) | ||
return v:true | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Extension to handle "fl/#" commands | ||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
|
||
"" | ||
" Respond with the full file reading | ||
function! langserver#extension#fs#readFille(filename) abort | ||
echom a:filename | ||
|
||
return join(readfile(a:filename), "\n") | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters