xna00 / unocss-language-server

MIT License
53 stars 8 forks source link

Completions not working at all #8

Closed siduck closed 3 weeks ago

siduck commented 11 months ago

hi @xna00 , i have used this lsp before and it worked fine but now the completions dont show up

image image

Also i do have the trigger_chars* setup in my cmp config too

Jason-Jay-Mason commented 10 months ago

@xna00, thanks for taking the time to build this for the community.

@siduck, It seems like @xna00 may be inactive at the time. In the mean time, I forked this and updated the packages. And everything seems to work:

https://github.com/Jason-Jay-Mason/unocss-language-server.git

Let me know if you need any help beyond that.

siduck commented 10 months ago

@xna00, thanks for taking the time to build this for the community.

@siduck, It seems like @xna00 may be inactive at the time. In the mean time, I branched this and updated the packages. And everything seems to work:

https://github.com/Jason-Jay-Mason/unocss-language-server.git

Let me know if you need any help beyond that.

hmm how am I supposed to install your version? same package name?

Jason-Jay-Mason commented 10 months ago

I don't have it on npm, because I want to avoid creating a competing implementation as I think a standard lsp for Uno is something that should ideally be offered by Unocss. Especially since this repo seems to be more of a shell while most of the actual implementation is being handled by @unocss/autocomplete. Anyways... you start by uninstalling your current version of unocss-language-server, then clone my fork and:

# navigate to the project in your console
cd /path/to/unocss-language-server
# run the build script
pnpm build
# link it globally
npm link

So that is building the project and linking it for global use via npm. This may work for you. Now, I had to also fix a dependency of @unocss/autocomlete: "fzf". I had to locate fzf in node_modules and delete "type:module" in its package.json. So you might need to do this too.

Also, it seems your using neovim, so make sure you are instantiating the lsp (assuming your using lspconfig):

-- ...somewhere inside your nvim config
local config = require('lspconfig')
config.unocss.setup {}

A bit hacky for now, but unocss is new, the tooling will get there with time and contributions from the community.

siduck commented 10 months ago

ugh the 2nd step seems like a bad workaround :sob:

Jason-Jay-Mason commented 10 months ago

Right @siduck, I agree, but it's all I have for ya. Let me know if you find something better! When I get time, I may look at contributing to unocss to help get a core lsp implementation going, that feels like the right move instead of maintaining a separate wrapper like this. Best of luck.

javlocan commented 10 months ago

Hey! Sorry if anything I ask here is too basic. I'm assuming some stuff and I might be wrong, my experience as a developer is limited. I'm also using Nvim.

I followed your instructions (cloned, installed** and linked to global npm). Couldn't find "type:module" or any variant I could think off in reference or my npm global directory. Could you help me? Last week I'm sure I was able to use this even with Attributify (that's my goal)

Thanks for taking the time.

carere commented 9 months ago

@javlocan you need to go the node_modules folder inside unocss-language-server, and then locate the fzf folder and inside the package.json, you need to remove the line "type": "module". @Jason-Jay-Mason thx for your fork, I'm using it and it works like a charm, I'll try to update the code in order to provide a classRegexp like feature like with TailwindCss Configuration :)

javlocan commented 9 months ago

@javlocan you need to go the node_modules folder inside unocss-language-server, and then locate the fzf folder and inside the package.json, you need to remove the line "type": "module". @Jason-Jay-Mason thx for your fork, I'm using it and it works like a charm, I'll try to update the code in order to provide a classRegexp like feature like with TailwindCss Configuration :)

Screenshot_20231025_150006

These are the places I've looked and the result of the find attempt. I cannot find fzf inside here!

carere commented 9 months ago

You should clone the https://github.com/Jason-Jay-Mason/unocss-language-server repo, then npm i / pnpm i inside the repo, then, in the node_modules folder generated, you should find the fzf folder, and follow as I explained on my previous message.

h4rldev commented 4 months ago

Hello, uhh there's no fzf folder generated

RayGuo-ergou commented 4 months ago

Hello, uhh there's no fzf folder generated

If you install with pnpm it's in node_modules/.pnpm

NDK2020 commented 4 months ago

Hi,

I can't get autocompletion to work in Nuxt version 3.11.1

I get this error of LSP when open a file vue:

Client 2 quit with exit code 1 and signal 0

LspInfo

 Other clients that match the filetype: vue

 Config: unocss
    filetypes:         vue
    root directory:    /home/user/work/dev/learn.nuxt.com
    cmd:               /home/user/.local/share/nvim/mason/bin/unocss-language-server --stdio
    cmd is executable: true
    autostart:         true
    custom handlers:   

I follow suggestion of @Jason-Jay-Mason, also delete type:modules and it still get the same error.

siduck commented 3 weeks ago

i can confirm that completions work now, to everyone else facing this issue, make sure node_modules are installed