Random stuff to do with scripting
This commit is contained in:
@@ -54,6 +54,12 @@ std::shared_ptr<LSPInstance> get_or_init_lsp(uint8_t lsp_id) {
|
||||
pending->callback = [lsp, lsp_id](Editor *, std::string, json msg) {
|
||||
if (msg.contains("result") && msg["result"].contains("capabilities")) {
|
||||
auto &caps = msg["result"]["capabilities"];
|
||||
if (caps.contains("positionEncoding")) {
|
||||
std::string s = caps["positionEncoding"].get<std::string>();
|
||||
if (s == "utf-8")
|
||||
lsp->is_utf8 = true;
|
||||
log("Lsp name: %s, supports: %s", lsp->lsp->command, s.c_str());
|
||||
}
|
||||
if (caps.contains("textDocumentSync")) {
|
||||
auto &sync = caps["textDocumentSync"];
|
||||
if (sync.is_number()) {
|
||||
@@ -65,8 +71,9 @@ std::shared_ptr<LSPInstance> get_or_init_lsp(uint8_t lsp_id) {
|
||||
}
|
||||
}
|
||||
lsp->allow_formatting = caps.value("documentFormattingProvider", false);
|
||||
if (lsp_id != LUA_LS /* Lua ls gives terrible ontype formatting */ &&
|
||||
caps.contains("documentOnTypeFormattingProvider")) {
|
||||
if (lsp_id !=
|
||||
LUA_LS /* Lua ls gives terrible ontype formatting so disable */
|
||||
&& caps.contains("documentOnTypeFormattingProvider")) {
|
||||
auto &fmt = caps["documentOnTypeFormattingProvider"];
|
||||
if (fmt.is_object()) {
|
||||
if (fmt.contains("firstTriggerCharacter")) {
|
||||
|
||||
Reference in New Issue
Block a user