Giter Site home page Giter Site logo

Comments (8)

 avatar commented on May 25, 2024

lsp-bridge代码用的是最新的commit。

我的tailwindcss.json配置如下:

{
  "name": "tailwindcss",
  "languageId": "html",
  "command": ["tailwindcss-language-server", "--stdio"],
  "settings": {},
  "initializationOptions": {
    "configuration": {
      "tailwindCSS": {
        "emmetCompletions": false,
        "showPixelEquivalents": true,
        "rootFontSize": 16,
        "validate": true,
        "lint": {
          "invalidScreen": "error",
          "invalidVariant": "error",
          "invalidTailwindDirective": "error",
          "invalidApply": "error",
          "invalidConfigPath": "error",
          "cssConflict": "warning",
          "recommendedVariantOrder": "warning"
        },
        "experimental": {
          "classRegex": ""
        },
        "classAttributes": ["class", "className", "ngClass"]
      }
    }
  }
}

其中的 initializationOptions 是tailwindcss必须要传递的。

从lsp-bridge的日志上看,初始化的参数配置如下:

{
   "id": 28384,
   "method": "initialize",
   "params": {
      "processId": 1352672,
      "rootPath": "/home/evanmeek/Documents/code/project/web/domeland-ui",
      "clientInfo": {
         "name": "emacs",
         "version": "GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)\n of 2022-04-28"
      },
      "rootUri": "file:///home/evanmeek/Documents/code/project/web/domeland-ui",
      "capabilities": {
         "workspace": {
            "configuration": true
         },
         "textDocument": {
            "completion": {
               "completionItem": {
                  "snippetSupport": true,
                  "deprecatedSupport": true,
                  "tagSupport": {
                     "valueSet": [
                        1
                     ]
                  }
               }
            }
         }
      },
      "initializationOptions": {
         "configuration": {
            "tailwindCSS": {
               "emmetCompletions": false,
               "showPixelEquivalents": true,
               "rootFontSize": 16,
               "validate": true,
               "lint": {
                  "invalidScreen": "error",
                  "invalidVariant": "error",
                  "invalidTailwindDirective": "error",
                  "invalidApply": "error",
                  "invalidConfigPath": "error",
                  "cssConflict": "warning",
                  "recommendedVariantOrder": "warning"
               },
               "experimental": {
                  "classRegex": ""
               },
               "classAttributes": [
                  "class",
                  "className",
                  "ngClass"
               ]
            }
         }
      }
   },
   "jsonrpc": "2.0"
}

可以看到自动加上了 capabilities 还做了一些额外的配置,例如 textDocument/completion

但是初始化失败了,得到如下返回数据:

{
   "jsonrpc": "2.0",
   "id": 28384,
   "error": {
      "code": -32603,
      "message": "Request initialize failed with message: Cannot read properties of undefined (reading 'dynamicRegistration')"
   }
}

我参考了一下 lsp 的文档 textDocument_completion

解决方法可能是: 还得加上 dynamicRegistration 字段? 从报错日志上来看是没有读取到这个属性才出现的问题。

我尝试修改了源码,为 capabilitiestextDocument/completion 加上 dynamicRegistration 字段 ,仍然会提示这个错误,看来得从tailwindcss server的源码入手了。

from lsp-bridge.

manateelazycat avatar manateelazycat commented on May 25, 2024

可以研究 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize 关于 dynamicRegistration 的描述

from lsp-bridge.

 avatar commented on May 25, 2024

可以研究 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize 关于 dynamicRegistration 的描述

我仔细看了你所提到的 dynamicRegistration 部分。

我的理解是: dynamicRegistration必须得由client支持才能使用,那么目前lsp-bridge是不支持 dynamicRegistration 所以也间接无法支持tailwindcss server是么?

from lsp-bridge.

manateelazycat avatar manateelazycat commented on May 25, 2024

可以研究 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize 关于 dynamicRegistration 的描述

我仔细看了你所提到的 dynamicRegistration 部分。

我的理解是: dynamicRegistration必须得由client支持才能使用,那么目前lsp-bridge是不支持 dynamicRegistration 所以也间接无法支持tailwindcss server是么?

你可以先把 initialize 请求中加入 dynamicRegistration 选项,先让 tailwindcss 启动起来,然后他会发送 dynamicRegistration 请求给 lsp-bridge , 到时候我们再看怎么响应它。

先让他启动起来。

from lsp-bridge.

 avatar commented on May 25, 2024

可以研究 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize 关于 dynamicRegistration 的描述

我仔细看了你所提到的 dynamicRegistration 部分。
我的理解是: dynamicRegistration必须得由client支持才能使用,那么目前lsp-bridge是不支持 dynamicRegistration 所以也间接无法支持tailwindcss server是么?

你可以先把 initialize 请求中加入 dynamicRegistration 选项,先让 tailwindcss 启动起来,然后他会发送 dynamicRegistration 请求给 lsp-bridge , 到时候我们再看怎么响应它。

先让他启动起来。

我尝试过这么做了。但是server仍然返回提示找不到 dynamicRegistration 这个属性。

from lsp-bridge.

 avatar commented on May 25, 2024

可以研究 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize 关于 dynamicRegistration 的描述

我仔细看了你所提到的 dynamicRegistration 部分。
我的理解是: dynamicRegistration必须得由client支持才能使用,那么目前lsp-bridge是不支持 dynamicRegistration 所以也间接无法支持tailwindcss server是么?

你可以先把 initialize 请求中加入 dynamicRegistration 选项,先让 tailwindcss 启动起来,然后他会发送 dynamicRegistration 请求给 lsp-bridge , 到时候我们再看怎么响应它。
先让他启动起来。

我尝试过这么做了。但是server仍然返回提示找不到 dynamicRegistration 这个属性。

我的做法是为 https://github.com/evanmeek/lsp-bridge/tree/3e17a8423a844030d685235dfb0476e5f1ce123e/core/lspserver.py 添加 dynamicRegistration属性

"textDocument": {
                    "completion": {
                        "dynamicRegistration": False,
                        "completionItem": {
                            "snippetSupport": False if not is_snippet_support else True,
                            "deprecatedSupport": True,
                            "tagSupport": {"valueSet": [1]},
                        },
                    }
                },

from lsp-bridge.

wsw0108 avatar wsw0108 commented on May 25, 2024

试着加上definition/reference等的key,值可以是{},和completion同级的。

错误消息已经告诉了是读undefined的dynamicxxx属性

from lsp-bridge.

manateelazycat avatar manateelazycat commented on May 25, 2024

先关闭吧,等大佬新作。

from lsp-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.