Created
March 19, 2020 00:44
-
-
Save bolinfest/2474367e6f923fdb98df1c409616c8ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env node | |
// Run this file to generate initialize.rpc in the same directory. | |
// Then to test it: | |
// | |
// Microsoft.Python.LanguageServer < /Users/mbolin/src/test-lsp/initialize.rpc | |
// | |
// Ideally, the LSP would reply on stdout. | |
const fs = require("fs"); | |
const body = { | |
"jsonrpc": "2.0", | |
"id": 0, | |
"method": "initialize", | |
"params": { | |
"rootPath": null, | |
"rootUri": "file:///Users/mbolin/fbsource/fbcode/scm/myles/client", | |
"capabilities": { | |
"workspace": { | |
"applyEdit": true, | |
"workspaceEdit": { | |
"documentChanges": true, | |
"resourceOperations": [ | |
"create", | |
"rename", | |
"delete" | |
], | |
"failureHandling": "textOnlyTransactional" | |
}, | |
"didChangeConfiguration": { | |
"dynamicRegistration": true | |
}, | |
"didChangeWatchedFiles": { | |
"dynamicRegistration": true | |
}, | |
"symbol": { | |
"dynamicRegistration": true, | |
"symbolKind": { | |
"valueSet": [ | |
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 | |
] | |
} | |
}, | |
"executeCommand": { | |
"dynamicRegistration": true | |
}, | |
// monaco-languageclient seems to default to true for this? | |
"configuration": false, | |
"workspaceFolders": true | |
}, | |
"textDocument": { | |
"publishDiagnostics": { | |
"relatedInformation": true, | |
"tagSupport": true | |
}, | |
"synchronization": { | |
"dynamicRegistration": true, | |
"willSave": true, | |
"willSaveWaitUntil": true, | |
"didSave": true | |
}, | |
"completion": { | |
"dynamicRegistration": true, | |
"contextSupport": true, | |
"completionItem": { | |
"snippetSupport": true, | |
"commitCharactersSupport": true, | |
"documentationFormat": [ | |
"markdown", | |
"plaintext" | |
], | |
"deprecatedSupport": true, | |
"preselectSupport": true | |
}, | |
"completionItemKind": { | |
"valueSet": [ | |
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 | |
] | |
} | |
}, | |
"hover": { | |
"dynamicRegistration": true, | |
"contentFormat": [ | |
"markdown", | |
"plaintext" | |
] | |
}, | |
"signatureHelp": { | |
"dynamicRegistration": true, | |
"signatureInformation": { | |
"documentationFormat": [ | |
"markdown", | |
"plaintext" | |
], | |
"parameterInformation": { | |
"labelOffsetSupport": true | |
} | |
} | |
}, | |
"definition": { | |
"dynamicRegistration": true, | |
"linkSupport": true | |
}, | |
"references": { | |
"dynamicRegistration": true | |
}, | |
"documentHighlight": { | |
"dynamicRegistration": true | |
}, | |
"documentSymbol": { | |
"dynamicRegistration": true, | |
"symbolKind": { | |
"valueSet": [ | |
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 | |
] | |
}, | |
"hierarchicalDocumentSymbolSupport": true | |
}, | |
"codeAction": { | |
"dynamicRegistration": true, | |
"codeActionLiteralSupport": { | |
"codeActionKind": { | |
"valueSet": [ | |
"", | |
"quickfix", | |
"refactor", | |
"refactor.extract", | |
"refactor.inline", | |
"refactor.rewrite", | |
"source", | |
"source.organizeImports" | |
] | |
} | |
} | |
}, | |
"codeLens": { | |
"dynamicRegistration": true | |
}, | |
"formatting": { | |
"dynamicRegistration": true | |
}, | |
"rangeFormatting": { | |
"dynamicRegistration": true | |
}, | |
"onTypeFormatting": { | |
"dynamicRegistration": true | |
}, | |
"rename": { | |
"dynamicRegistration": true, | |
"prepareSupport": true | |
}, | |
"documentLink": { | |
"dynamicRegistration": true | |
}, | |
"typeDefinition": { | |
"dynamicRegistration": true, | |
"linkSupport": true | |
}, | |
"implementation": { | |
"dynamicRegistration": true, | |
"linkSupport": true | |
}, | |
"colorProvider": { | |
"dynamicRegistration": true | |
}, | |
"foldingRange": { | |
"dynamicRegistration": true, | |
"rangeLimit": 5000, | |
"lineFoldingOnly": true | |
}, | |
"declaration": { | |
"dynamicRegistration": true, | |
"linkSupport": true | |
} | |
} | |
}, | |
"initializationOptions": { | |
"interpreter": { | |
"properties": { | |
"InterpreterPath": "/usr/local/bin/python3", | |
"Version": "3.7.5", | |
"UseDefaultDatabase": true | |
} | |
}, | |
displayOptions: { | |
preferredFormat: 'markdown', | |
trimDocumentationLines: false, | |
maxDocumentationLineLength: 0, | |
trimDocumentationText: false, | |
maxDocumentationTextLength: 0, | |
}, | |
analysisUpdates: true, | |
traceLogging: true, | |
asyncStartup: true, | |
excludeFiles: ['**/Lib/**', '**/site-packages/**'], | |
// searchPaths: this.activeKernelRuntimeDir, | |
// cacheFolderPath, | |
}, | |
"trace": "off", | |
"workspaceFolders": null | |
} | |
}; | |
const serializedBody = JSON.stringify(body, /*replacer*/null, /*indent*/2); | |
const message = `Content-Length: ${serializedBody.length}\r\n\r\n${serializedBody}`; | |
fs.writeFileSync("./initialize.rpc", message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment