From 8763b3aaa594122ace48d81f9547f4246d5a8b96 Mon Sep 17 00:00:00 2001 From: Binbin Ye Date: Mon, 30 Oct 2023 15:08:02 +0900 Subject: [PATCH 1/2] fix: choose lanugage id based on extension when using css lsp --- core/lspserver.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/lspserver.py b/core/lspserver.py index cb5fb153e8..8b6706b012 100755 --- a/core/lspserver.py +++ b/core/lspserver.py @@ -391,6 +391,16 @@ def parse_document_uri(self, filepath, external_file_link): return uri def send_did_open_notification(self, fa: "FileAction"): + # vscode-css-language-server uses languageId to initialize from different entry points + if self.server_info["name"] == "vscode-css-language-server": + _, extension = os.path.splitext(fa.filepath) + if extension == ".less": + self.server_info["languageId"] = "less" + elif extension == ".scss" or extension == ".sass": + self.server_info["languageId"] = "scss" + else: + self.server_info["languageId"] = "css" + self.sender.send_notification("textDocument/didOpen", { "textDocument": { "uri": self.parse_document_uri(fa.filepath, fa.external_file_link), From 59a8e979216bd676c3cd9ddbd821ecc1ebca818e Mon Sep 17 00:00:00 2001 From: Binbin Ye Date: Mon, 30 Oct 2023 16:15:59 +0900 Subject: [PATCH 2/2] fix eslint lsp config that workspace config requires full settings --- core/lspserver.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/lspserver.py b/core/lspserver.py index 8b6706b012..ea749d6955 100755 --- a/core/lspserver.py +++ b/core/lspserver.py @@ -26,6 +26,7 @@ import subprocess import threading import traceback +import copy from subprocess import PIPE from sys import stderr from typing import TYPE_CHECKING, Dict @@ -510,6 +511,7 @@ def handle_workspace_configuration_request(self, name, request_id, params): sessionSettings = settings.get(section, {}) if self.server_info["name"] == "vscode-eslint-language-server": + sessionSettings = copy.copy(settings) sessionSettings["workspaceFolder"] = { "name": self.project_name, "uri": path_to_uri(self.project_path),