xna00 / unocss-language-server

MIT License
53 stars 8 forks source link

Error during completion #3

Closed sweepline closed 1 year ago

sweepline commented 1 year ago

When sending the following

[DEBUG][2023-03-05 14:19:06] .../lua/vim/lsp.lua:1381   "LSP[unocss]"   "client.request"    4   "textDocument/completion"   {  context = {    triggerKind = 1  },  position = {    character = 21,    line = 2  },  textDocument = {    uri = "file:///filelocation/file.tsx"  }}   <function 1>    22

I get the following error back

[DEBUG][2023-03-05 14:19:07] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  error = {    code = -32603,    message = "Request textDocument/completion failed with message: Cannot read properties of undefined (reading 'join')"  },  id = 10,  jsonrpc = "2.0"}

The file was like so at the time

export default function NotFound() {
    return (
        <section class="bg- p-8 text-gray-700">
            <h1 class="text-2xl font-bold">404: Not Found</h1>
            <p class="mt-4">It's gone 😞</p>
        </section>
    );
}

It does not matter what file i try, same result.

xna00 commented 1 year ago

I can't reproduce it. Are you using the latest version?

sweepline commented 1 year ago

I installed it trough mason today. I guess i will have to try making a more minimal reproduction. Edit: It should be v0.0.7 as per mason package.lock

{
  "name": "@mason/unocss-language-server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "unocss-language-server": "^0.0.7"
  }
}
sweepline commented 1 year ago

With the following init.lua it still gives the same error I'm using NVIM v0.8.3 . And here i installed the newest version through NPM, like in the readme

vim.g.mapleader = " "

local fn = vim.fn
local execute = vim.api.nvim_command

-- Packer
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"

if fn.empty(fn.glob(install_path)) > 0 then
    fn.system({
        "git", "clone", "https://github.com/wbthomason/packer.nvim",
        install_path
    })
    execute "packadd packer.nvim"
end

vim.cmd("packadd packer.nvim")
-- Auto compile when there are changes in plugins.lua
-- vim.cmd([[autocmd BufWritePost plugins.lua source <afile> | PackerCompile]])
vim.cmd("autocmd BufWritePost plugins.lua PackerCompile") -- Auto compile when there are changes in plugins.lua

local nvim_lsp = require("lspconfig")

vim.g.coq_settings = { auto_start = 'shut-up', completion = { always = false } }
local coq = require "coq"

-- Mappings
local opts = { noremap = true, silent = true }

-- Your custom attach function for nvim-lspconfig goes here.
local on_attach = function(client, bufnr)
    vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
    vim.api.nvim_buf_set_keymap(bufnr, "n", "K",
        "<cmd>lua vim.lsp.buf.hover()<CR>", opts)

    vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>ca",
        "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
end

nvim_lsp.unocss.setup(coq.lsp_ensure_capabilities { on_attach = on_attach })
nvim_lsp.tsserver.setup(coq.lsp_ensure_capabilities {
    on_attach = function(client, bufnr)
        if client.config.flags then
            client.config.flags.allow_incremental_sync = true
        end
        client.server_capabilities.document_formatting = false
        on_attach(client, bufnr)
    end
})

The TSServer goes through fine, i get the same error as originally in this issue. and my :checkhealth


man: require("man.health").check()
========================================================================
  - OK: plugin/man.vim not in $VIMRUNTIME
  - OK: autoload/man.vim not in $VIMRUNTIME

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - OK: **Go**: `go version go1.20.1 linux/amd64`
  - OK: **cargo**: `cargo 1.69.0-nightly (9880b408a 2023-02-28)`
  - WARNING: **luarocks**: not available
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `8.19.2`
  - OK: **node**: `v16.19.1`
  - OK: **python3**: `Python 3.10.9`
  - OK: **pip3**: `pip 23.0.1 from /usr/lib/python3.10/site-packages/pip (python 3.10)`
  - WARNING: **javac**: not available
  - WARNING: **java**: not available
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
  - OK: **curl**: `curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.52.0`
  - OK: **gzip**: `gzip 1.12`
  - OK: **tar**: `tar (GNU tar) 1.34`
  - WARNING: **pwsh**: not available
  - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 2. Remaining: 58. Limit: 60. Reset: 2023-03-05T19:18:41 KST.

null-ls: require("null-ls.health").check()
========================================================================
  - OK: eslint_d: the command "eslint_d" is executable.
  - OK: eslint_d: the command "eslint_d" is executable.
  - OK: flake8: the command "flake8" is executable.
  - OK: mypy: the command "mypy" is executable.
  - OK: stylelint: the command "stylelint" is executable.
  - OK: black: the command "black" is executable.
  - OK: prettier: the command "prettier" is executable.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v16.19.1 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (GCC) 12.2.1 20230201
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## OS Info:
{
  machine = "x86_64",
  release = "6.2.2-arch1-1",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:31 +0000"
}

## Parser/Features         H L F I J
SKIPPED FOR BREVITY

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: wl-copy

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.10.9
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - WARNING: `ruby` and `gem` must be in $PATH.
    - ADVICE:
      - Install Ruby and verify that `ruby` and `gem` commands work.

## Node.js provider (optional)
  - INFO: Node.js: v16.19.1
  - INFO: Nvim node.js host: /usr/lib/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn/pnpm package is installed: 4.10.1

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.7.0

## ===== Installed extensions =====

## Telescope Extension: `ui-select`
  - INFO: No healthcheck provided

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/mikkel/.local/state/nvim/lsp.log
  - INFO: Log size: 11262 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
ALL OK
xna00 commented 1 year ago

Could you please provide full LSP logs?

sweepline commented 1 year ago
[START][2023-03-05 19:36:12] LSP logging initiated
[INFO][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:661 "Starting RPC client"   {  args = { "--stdio" },  cmd = "unocss-language-server",  extra = {    cwd = "/home/mikkel/repos/kassen/frontend"  }}
[TRACE][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1276   "LSP[unocss]"   "initialize_params" {  capabilities = {    callHierarchy = {      dynamicRegistration = false    },    textDocument = {      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }          }        },        dataSupport = true,        dynamicRegistration = false,        isPreferredSupport = true,        resolveSupport = {          properties = { "edit" }        }      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = true,          documentationFormat = { "markdown", "plaintext" },          insertReplaceSupport = true,          insertTextModeSupport = {            valueSet = { 1, 2 }          },          labelDetailsSupport = true,          preselectSupport = true,          resolveSupport = {            properties = {}          },          snippetSupport = true,          tagSupport = {            valueSet = { 1 }          }        },        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 }        },        contextSupport = false,        dynamicRegistration = false      },      declaration = {        linkSupport = true      },      definition = {        linkSupport = true      },      documentHighlight = {        dynamicRegistration = false      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymbolSupport = 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 }        }      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false      },      implementation = {        linkSupport = true      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 }        }      },      references = {        dynamicRegistration = false      },      rename = {        dynamicRegistration = false,        prepareSupport = true      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          activeParameterSupport = true,          documentationFormat = { "markdown", "plaintext" },          parameterInformation = {            labelOffsetSupport = true          }        }      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = false,        willSaveWaitUntil = false      },      typeDefinition = {        linkSupport = true      }    },    window = {      showDocument = {        support = false      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false        }      },      workDoneProgress = true    },    workspace = {      applyEdit = true,      configuration = true,      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = 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 }        }      },      workspaceEdit = {        resourceOperations = { "rename", "create", "delete" }      },      workspaceFolders = true    }  },  clientInfo = {    name = "Neovim",    version = "0.8.3"  },  initializationOptions = vim.empty_dict(),  processId = 271751,  rootPath = "/home/mikkel/repos/kassen/frontend",  rootUri = "file:///home/mikkel/repos/kassen/frontend",  trace = "off",  workspaceFolders = { {      name = "/home/mikkel/repos/kassen/frontend",      uri = "file:///home/mikkel/repos/kassen/frontend"    } }}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = false,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            insertTextModeSupport = {              valueSet = { 1, 2 }            },            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = {}            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          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 }          },          contextSupport = false,          dynamicRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          linkSupport = true        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = 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 }          }        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false        },        implementation = {          linkSupport = true        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = false,          prepareSupport = true        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = false        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        symbol = {          dynamicRegistration = false,          hierarchicalWorkspaceSymbolSupport = 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 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.8.3"    },    initializationOptions = vim.empty_dict(),    processId = 271751,    rootPath = "/home/mikkel/repos/kassen/frontend",    rootUri = "file:///home/mikkel/repos/kassen/frontend",    trace = "off",    workspaceFolders = { {        name = "/home/mikkel/repos/kassen/frontend",        uri = "file:///home/mikkel/repos/kassen/frontend"      } }  }}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      colorProvider = true,      completionProvider = {        resolveProvider = true      },      documentHighlightProvider = true,      hoverProvider = true,      textDocumentSync = 2,      workspace = {        workspaceFolders = {          supported = true        }      }    }  }}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[INFO][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1336    "LSP[unocss]"   "server_capabilities"   {  server_capabilities = {    colorProvider = true,    completionProvider = {      resolveProvider = true    },    documentHighlightProvider = true,    hoverProvider = true,    textDocumentSync = {      change = 2,      openClose = true,      save = {        includeText = false      },      willSave = false,      willSaveWaitUntil = false    },    workspace = {      workspaceFolders = {        supported = true      }    }  }}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "typescriptreact",      text = "export default function NotFound() {\n\treturn (\n\t\t<section class=\"p-8 text-gray-700\">\n\t\t\t<h1 class=\"text-2xl font-bold\">404: Not Found</h1>\n\t\t\t<p class=\"mt-4\">It's gone 😞</p>\n\t\t</section>\n\t);\n}\n",      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 0    }  }}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 0,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "9bf78b55-1ed3-4f25-85a2-0c8d57b86e73",        method = "workspace/didChangeConfiguration",        registerOptions = vim.empty_dict()      } }  }}
[TRACE][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1059   "server_request"    "client/registerCapability" {  registrations = { {      id = "9bf78b55-1ed3-4f25-85a2-0c8d57b86e73",      method = "workspace/didChangeConfiguration",      registerOptions = vim.empty_dict()    } }}
[TRACE][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1062   "server_request: found handler for" "client/registerCapability"
[TRACE][2023-03-05 19:36:12] ...lsp/handlers.lua:519    "default_handler"   "client/registerCapability" {  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',  result = {    registrations = { {        id = "9bf78b55-1ed3-4f25-85a2-0c8d57b86e73",        method = "workspace/didChangeConfiguration",        registerOptions = vim.empty_dict()      } }  }}
[WARN][2023-03-05 19:36:12] ...lsp/handlers.lua:113 "The language server unocss triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:403    "server_request: callback result"   {  result = vim.NIL,  status = true}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 1,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "474cc45b-d134-43c1-9da7-599e1563037c",        method = "workspace/didChangeWorkspaceFolders",        registerOptions = vim.empty_dict()      } }  }}
[TRACE][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1059   "server_request"    "client/registerCapability" {  registrations = { {      id = "474cc45b-d134-43c1-9da7-599e1563037c",      method = "workspace/didChangeWorkspaceFolders",      registerOptions = vim.empty_dict()    } }}
[TRACE][2023-03-05 19:36:12] .../lua/vim/lsp.lua:1062   "server_request: found handler for" "client/registerCapability"
[TRACE][2023-03-05 19:36:12] ...lsp/handlers.lua:519    "default_handler"   "client/registerCapability" {  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',  result = {    registrations = { {        id = "474cc45b-d134-43c1-9da7-599e1563037c",        method = "workspace/didChangeWorkspaceFolders",        registerOptions = vim.empty_dict()      } }  }}
[WARN][2023-03-05 19:36:12] ...lsp/handlers.lua:113 "The language server unocss triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:403    "server_request: callback result"   {  result = vim.NIL,  status = true}
[DEBUG][2023-03-05 19:36:12] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 1,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-03-05 19:36:15] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 18,            line = 2          },          start = {            character = 18,            line = 2          }        },        rangeLength = 0,        text = "i"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 5    }  }}
[DEBUG][2023-03-05 19:36:16] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 18,            line = 2          }        },        rangeLength = 1,        text = ""      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 6    }  }}
[DEBUG][2023-03-05 19:36:16] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 18,            line = 2          },          start = {            character = 18,            line = 2          }        },        rangeLength = 0,        text = "b"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 7    }  }}
[DEBUG][2023-03-05 19:36:16] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 19,            line = 2          }        },        rangeLength = 0,        text = "g"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 8    }  }}
[DEBUG][2023-03-05 19:36:16] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 20,            line = 2          },          start = {            character = 20,            line = 2          }        },        rangeLength = 0,        text = "-"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 9    }  }}
[DEBUG][2023-03-05 19:36:17] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 21,            line = 2          },          start = {            character = 21,            line = 2          }        },        rangeLength = 0,        text = " "      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 10    }  }}
[DEBUG][2023-03-05 19:36:18] .../lua/vim/lsp.lua:1381   "LSP[unocss]"   "client.request"    1   "textDocument/completion"   {  context = {    triggerKind = 1  },  position = {    character = 21,    line = 2  },  textDocument = {    uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx"  }}    <function 1>    1
[DEBUG][2023-03-05 19:36:18] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 2,  jsonrpc = "2.0",  method = "textDocument/completion",  params = {    context = {      triggerKind = 1    },    position = {      character = 21,      line = 2    },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx"    }  }}
[DEBUG][2023-03-05 19:36:18] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  error = {    code = -32603,    message = "Request textDocument/completion failed with message: Cannot read properties of undefined (reading 'join')"  },  id = 2,  jsonrpc = "2.0"}

Here you go

xna00 commented 1 year ago

I still can't reproduce the problem after many attempts. And I have checked all files, I think there is no dangerous .join. I have published a new version 0.0.8, adding some logs https://github.com/xna00/unocss-language-server/commit/25caea7e3a49f6755cff4427ed112f5434f65743 . You can help me by upgrading and checking logs.

sweepline commented 1 year ago
[START][2023-03-05 22:34:31] LSP logging initiated
[INFO][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:661 "Starting RPC client"   {  args = { "--stdio" },  cmd = "unocss-language-server",  extra = {    cwd = "/home/mikkel/repos/kassen/frontend"  }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1276   "LSP[unocss]"   "initialize_params" {  capabilities = {    callHierarchy = {      dynamicRegistration = false    },    textDocument = {      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }          }        },        dataSupport = true,        dynamicRegistration = false,        isPreferredSupport = true,        resolveSupport = {          properties = { "edit" }        }      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = true,          documentationFormat = { "markdown", "plaintext" },          insertReplaceSupport = true,          insertTextModeSupport = {            valueSet = { 1, 2 }          },          labelDetailsSupport = true,          preselectSupport = true,          resolveSupport = {            properties = {}          },          snippetSupport = true,          tagSupport = {            valueSet = { 1 }          }        },        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 }        },        contextSupport = false,        dynamicRegistration = false      },      declaration = {        linkSupport = true      },      definition = {        linkSupport = true      },      documentHighlight = {        dynamicRegistration = false      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymbolSupport = 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 }        }      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false      },      implementation = {        linkSupport = true      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 }        }      },      references = {        dynamicRegistration = false      },      rename = {        dynamicRegistration = false,        prepareSupport = true      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          activeParameterSupport = true,          documentationFormat = { "markdown", "plaintext" },          parameterInformation = {            labelOffsetSupport = true          }        }      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = false,        willSaveWaitUntil = false      },      typeDefinition = {        linkSupport = true      }    },    window = {      showDocument = {        support = false      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false        }      },      workDoneProgress = true    },    workspace = {      applyEdit = true,      configuration = true,      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = 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 }        }      },      workspaceEdit = {        resourceOperations = { "rename", "create", "delete" }      },      workspaceFolders = true    }  },  clientInfo = {    name = "Neovim",    version = "0.8.3"  },  initializationOptions = vim.empty_dict(),  processId = 313574,  rootPath = "/home/mikkel/repos/kassen/frontend",  rootUri = "file:///home/mikkel/repos/kassen/frontend",  trace = "off",  workspaceFolders = { {      name = "/home/mikkel/repos/kassen/frontend",      uri = "file:///home/mikkel/repos/kassen/frontend"    } }}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = false,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            insertTextModeSupport = {              valueSet = { 1, 2 }            },            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = {}            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          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 }          },          contextSupport = false,          dynamicRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          linkSupport = true        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = 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 }          }        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false        },        implementation = {          linkSupport = true        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = false,          prepareSupport = true        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = false        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        symbol = {          dynamicRegistration = false,          hierarchicalWorkspaceSymbolSupport = 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 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.8.3"    },    initializationOptions = vim.empty_dict(),    processId = 313574,    rootPath = "/home/mikkel/repos/kassen/frontend",    rootUri = "file:///home/mikkel/repos/kassen/frontend",    trace = "off",    workspaceFolders = { {        name = "/home/mikkel/repos/kassen/frontend",        uri = "file:///home/mikkel/repos/kassen/frontend"      } }  }}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "unocss: before add onCompletion listener",    type = 4  }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1045   "notification"  "window/logMessage" {  message = "unocss: before add onCompletion listener",  type = 4}
[TRACE][2023-03-05 22:34:31] ...lsp/handlers.lua:519    "default_handler"   "window/logMessage" {  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = "unocss: before add onCompletion listener",    type = 4  }}
[INFO][2023-03-05 22:34:31] ...lsp/handlers.lua:489 "unocss: before add onCompletion listener"
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "unocss: after add listener",    type = 4  }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1045   "notification"  "window/logMessage" {  message = "unocss: after add listener",  type = 4}
[TRACE][2023-03-05 22:34:31] ...lsp/handlers.lua:519    "default_handler"   "window/logMessage" {  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = "unocss: after add listener",    type = 4  }}
[INFO][2023-03-05 22:34:31] ...lsp/handlers.lua:489 "unocss: after add listener"
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      colorProvider = true,      completionProvider = {        resolveProvider = true      },      documentHighlightProvider = true,      hoverProvider = true,      textDocumentSync = 2,      workspace = {        workspaceFolders = {          supported = true        }      }    }  }}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[INFO][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1336    "LSP[unocss]"   "server_capabilities"   {  server_capabilities = {    colorProvider = true,    completionProvider = {      resolveProvider = true    },    documentHighlightProvider = true,    hoverProvider = true,    textDocumentSync = {      change = 2,      openClose = true,      save = {        includeText = false      },      willSave = false,      willSaveWaitUntil = false    },    workspace = {      workspaceFolders = {        supported = true      }    }  }}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "typescriptreact",      text = "export default function NotFound() {\n\treturn (\n\t\t<section class=\"p-8 text-gray-700\">\n\t\t\t<h1 class=\"text-2xl font-bold\">404: Not Found</h1>\n\t\t\t<p class=\"mt-4\">It's gone 😞</p>\n\t\t</section>\n\t);\n}\n",      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 0    }  }}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 0,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "60681c35-e223-4e79-a393-8c4dd4a34667",        method = "workspace/didChangeConfiguration",        registerOptions = vim.empty_dict()      } }  }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1059   "server_request"    "client/registerCapability" {  registrations = { {      id = "60681c35-e223-4e79-a393-8c4dd4a34667",      method = "workspace/didChangeConfiguration",      registerOptions = vim.empty_dict()    } }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1062   "server_request: found handler for" "client/registerCapability"
[TRACE][2023-03-05 22:34:31] ...lsp/handlers.lua:519    "default_handler"   "client/registerCapability" {  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',  result = {    registrations = { {        id = "60681c35-e223-4e79-a393-8c4dd4a34667",        method = "workspace/didChangeConfiguration",        registerOptions = vim.empty_dict()      } }  }}
[WARN][2023-03-05 22:34:31] ...lsp/handlers.lua:113 "The language server unocss triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:403    "server_request: callback result"   {  result = vim.NIL,  status = true}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  id = 1,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "641e6df7-12e9-480e-86a0-3c4d1ed621b0",        method = "workspace/didChangeWorkspaceFolders",        registerOptions = vim.empty_dict()      } }  }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1059   "server_request"    "client/registerCapability" {  registrations = { {      id = "641e6df7-12e9-480e-86a0-3c4d1ed621b0",      method = "workspace/didChangeWorkspaceFolders",      registerOptions = vim.empty_dict()    } }}
[TRACE][2023-03-05 22:34:31] .../lua/vim/lsp.lua:1062   "server_request: found handler for" "client/registerCapability"
[TRACE][2023-03-05 22:34:31] ...lsp/handlers.lua:519    "default_handler"   "client/registerCapability" {  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',  result = {    registrations = { {        id = "641e6df7-12e9-480e-86a0-3c4d1ed621b0",        method = "workspace/didChangeWorkspaceFolders",        registerOptions = vim.empty_dict()      } }  }}
[WARN][2023-03-05 22:34:31] ...lsp/handlers.lua:113 "The language server unocss triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:403    "server_request: callback result"   {  result = vim.NIL,  status = true}
[DEBUG][2023-03-05 22:34:31] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 1,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-03-05 22:34:35] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 18,            line = 2          },          start = {            character = 18,            line = 2          }        },        rangeLength = 0,        text = " "      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 5    }  }}
[DEBUG][2023-03-05 22:34:36] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 18,            line = 2          },          start = {            character = 18,            line = 2          }        },        rangeLength = 0,        text = "b"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 6    }  }}
[DEBUG][2023-03-05 22:34:36] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 19,            line = 2          },          start = {            character = 19,            line = 2          }        },        rangeLength = 0,        text = "g"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 7    }  }}
[DEBUG][2023-03-05 22:34:37] .../vim/lsp/rpc.lua:285    "rpc.send"  {  jsonrpc = "2.0",  method = "textDocument/didChange",  params = {    contentChanges = { {        range = {          ["end"] = {            character = 20,            line = 2          },          start = {            character = 20,            line = 2          }        },        rangeLength = 0,        text = "-"      } },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx",      version = 8    }  }}
[DEBUG][2023-03-05 22:34:37] .../lua/vim/lsp.lua:1381   "LSP[unocss]"   "client.request"    1   "textDocument/completion"   {  context = {    triggerKind = 1  },  position = {    character = 21,    line = 2  },  textDocument = {    uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx"  }}    <function 1>    1
[DEBUG][2023-03-05 22:34:37] .../vim/lsp/rpc.lua:285    "rpc.send"  {  id = 2,  jsonrpc = "2.0",  method = "textDocument/completion",  params = {    context = {      triggerKind = 1    },    position = {      character = 21,      line = 2    },    textDocument = {      uri = "file:///home/mikkel/repos/kassen/frontend/src/errors/404.tsx"    }  }}
[DEBUG][2023-03-05 22:34:37] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "unocss: onCompletion start",    type = 4  }}
[TRACE][2023-03-05 22:34:37] .../lua/vim/lsp.lua:1045   "notification"  "window/logMessage" {  message = "unocss: onCompletion start",  type = 4}
[TRACE][2023-03-05 22:34:37] ...lsp/handlers.lua:519    "default_handler"   "window/logMessage" {  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = "unocss: onCompletion start",    type = 4  }}
[INFO][2023-03-05 22:34:37] ...lsp/handlers.lua:489 "unocss: onCompletion start"
[DEBUG][2023-03-05 22:34:38] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "unocss: onCompletion get content and cursor",    type = 4  }}
[TRACE][2023-03-05 22:34:38] .../lua/vim/lsp.lua:1045   "notification"  "window/logMessage" {  message = "unocss: onCompletion get content and cursor",  type = 4}
[TRACE][2023-03-05 22:34:38] ...lsp/handlers.lua:519    "default_handler"   "window/logMessage" {  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = "unocss: onCompletion get content and cursor",    type = 4  }}
[INFO][2023-03-05 22:34:38] ...lsp/handlers.lua:489 "unocss: onCompletion get content and cursor"
[DEBUG][2023-03-05 22:34:38] .../vim/lsp/rpc.lua:388    "rpc.receive"   {  error = {    code = -32603,    message = "Request textDocument/completion failed with message: Cannot read properties of undefined (reading 'join')"  },  id = 2,  jsonrpc = "2.0"}

I added another debug line after

if (!content || cursor === undefined) {
      return [];
}

So it seems it crashes in return autocomplete.suggestInFile(content, cursor); which is quite weird.

sweepline commented 1 year ago

Okay so I just tried to run the following code

import {
  getComplete,
} from "./service";

const message =
  'export default function NotFound() {\n\treturn (\n\t\t<section class="bg- p-8 text-gray-700">\n\t\t\t<h1 class="text-2xl font-bold">404: Not Found</h1>\n\t\t\t<p class="mt-4">It\'s gone 😞</p>\n\t\t</section>\n\t);\n}\n';
const cursor = 68;
getComplete(message, cursor).then((e) => {
  console.log(e);
});

And got the correct output

{
  suggestions: [
    [ 'bg-amber', 'bg-amber' ],
    [ 'bg-auto', 'bg-auto' ],
    [ 'bg-black', 'bg-black' ],
    [ 'bg-blend-color', 'bg-blend-color' ],
    [ 'bg-blend-color-burn', 'bg-blend-color-burn' ],
    [ 'bg-blend-color-dodge', 'bg-blend-color-dodge' ],
    [ 'bg-blend-darken', 'bg-blend-darken' ],
    [ 'bg-blend-difference', 'bg-blend-difference' ],
    [ 'bg-blend-exclusion', 'bg-blend-exclusion' ],
    [ 'bg-blend-hard-light', 'bg-blend-hard-light' ],
    [ 'bg-blend-hue', 'bg-blend-hue' ],
    [ 'bg-blend-inherit', 'bg-blend-inherit' ],
    [ 'bg-blend-initial', 'bg-blend-initial' ],
    [ 'bg-blend-lighten', 'bg-blend-lighten' ],
    [ 'bg-blend-luminosity', 'bg-blend-luminosity' ],
    [ 'bg-blend-multiply', 'bg-blend-multiply' ],
    [ 'bg-blend-normal', 'bg-blend-normal' ],
    [ 'bg-blend-overlay', 'bg-blend-overlay' ],
    [ 'bg-blend-revert', 'bg-blend-revert' ],
    [ 'bg-blend-revert-layer', 'bg-blend-revert-layer' ],
    [ 'bg-blend-saturation', 'bg-blend-saturation' ],
    [ 'bg-blend-screen', 'bg-blend-screen' ],
    [ 'bg-blend-soft-light', 'bg-blend-soft-light' ],
    [ 'bg-blend-unset', 'bg-blend-unset' ],
    [ 'bg-blue', 'bg-blue' ],
    [ 'bg-bluegray', 'bg-bluegray' ],
    [ 'bg-blueGray', 'bg-blueGray' ],
    [ 'bg-clip-border', 'bg-clip-border' ],
    [ 'bg-clip-content', 'bg-clip-content' ],
    [ 'bg-clip-inherit', 'bg-clip-inherit' ],
    [ 'bg-clip-initial', 'bg-clip-initial' ],
    [ 'bg-clip-padding', 'bg-clip-padding' ],
    [ 'bg-clip-revert', 'bg-clip-revert' ],
    [ 'bg-clip-revert-layer', 'bg-clip-revert-layer' ],
    [ 'bg-clip-text', 'bg-clip-text' ],
    [ 'bg-clip-unset', 'bg-clip-unset' ],
    [ 'bg-contain', 'bg-contain' ],
    [ 'bg-coolgray', 'bg-coolgray' ],
    [ 'bg-coolGray', 'bg-coolGray' ],
    [ 'bg-cover', 'bg-cover' ],
    [ 'bg-current', 'bg-current' ],
    [ 'bg-cyan', 'bg-cyan' ],
    [ 'bg-dark', 'bg-dark' ],
    [ 'bg-emerald', 'bg-emerald' ],
    [ 'bg-fixed', 'bg-fixed' ],
    [ 'bg-fuchsia', 'bg-fuchsia' ],
    [ 'bg-gradient', 'bg-gradient' ],
    [ 'bg-gradient-repeating', 'bg-gradient-repeating' ],
    [ 'bg-gradient-shape', 'bg-gradient-shape' ],
    [ 'bg-gray', 'bg-gray' ],
    [ 'bg-green', 'bg-green' ],
    [ 'bg-indigo', 'bg-indigo' ],
    [ 'bg-inherit', 'bg-inherit' ],
    [ 'bg-light', 'bg-light' ],
    [ 'bg-lightblue', 'bg-lightblue' ],
    [ 'bg-lightBlue', 'bg-lightBlue' ],
    [ 'bg-lime', 'bg-lime' ],
    [ 'bg-local', 'bg-local' ],
    [ 'bg-neutral', 'bg-neutral' ],
    [ 'bg-no-repeat', 'bg-no-repeat' ],
    [ 'bg-none', 'bg-none' ],
    [ 'bg-orange', 'bg-orange' ],
    [ 'bg-origin-border', 'bg-origin-border' ],
    [ 'bg-origin-content', 'bg-origin-content' ],
    [ 'bg-origin-inherit', 'bg-origin-inherit' ],
    [ 'bg-origin-initial', 'bg-origin-initial' ],
    [ 'bg-origin-padding', 'bg-origin-padding' ],
    [ 'bg-origin-revert', 'bg-origin-revert' ],
    [ 'bg-origin-revert-layer', 'bg-origin-revert-layer' ],
    [ 'bg-origin-unset', 'bg-origin-unset' ],
    [ 'bg-pink', 'bg-pink' ],
    [ 'bg-purple', 'bg-purple' ],
    [ 'bg-red', 'bg-red' ],
    [ 'bg-repeat', 'bg-repeat' ],
    [ 'bg-repeat-inherit', 'bg-repeat-inherit' ],
    [ 'bg-repeat-initial', 'bg-repeat-initial' ],
    [ 'bg-repeat-revert', 'bg-repeat-revert' ],
    [ 'bg-repeat-revert-layer', 'bg-repeat-revert-layer' ],
    [ 'bg-repeat-round', 'bg-repeat-round' ],
    [ 'bg-repeat-space', 'bg-repeat-space' ],
    [ 'bg-repeat-unset', 'bg-repeat-unset' ],
    [ 'bg-repeat-x', 'bg-repeat-x' ],
    [ 'bg-repeat-y', 'bg-repeat-y' ],
    [ 'bg-rose', 'bg-rose' ],
    [ 'bg-scroll', 'bg-scroll' ],
    [ 'bg-sky', 'bg-sky' ],
    [ 'bg-slate', 'bg-slate' ],
    [ 'bg-stone', 'bg-stone' ],
    [ 'bg-teal', 'bg-teal' ],
    [ 'bg-transparent', 'bg-transparent' ],
    [ 'bg-truegray', 'bg-truegray' ],
    [ 'bg-trueGray', 'bg-trueGray' ],
    [ 'bg-violet', 'bg-violet' ],
    [ 'bg-warmgray', 'bg-warmgray' ],
    [ 'bg-warmGray', 'bg-warmGray' ],
    [ 'bg-white', 'bg-white' ],
    [ 'bg-yellow', 'bg-yellow' ],
    [ 'bg-zinc', 'bg-zinc' ]
  ],
  resolveReplacement: [Function: resolveReplacement]
}

Maybe its something to do with my unocss.config.ts is loaded wrong or something?

xna00 commented 1 year ago

Maybe the exception is thrown from unocss.config.ts by some plugins?

sweepline commented 1 year ago

I solved the issue, and it was indeed to do with the configuration of the unocss.config.ts. I had use this config from the solidjs starter template. This makes your language-server silently fail, but not the official vscode plugin. Specifically the export default defineConfig

xna00 commented 1 year ago

The problem is in presetMini:

re = new RegExp(`^(important(?:${ctx.generator.config.separators.join("|")})|!)`);

I set a default value for separators. It's ok in 0.0.10.