Git Product home page Git Product logo

Comments (22)

Guldoman avatar Guldoman commented on September 16, 2024 1

Thanks for testing!

from lite-xl-lsp.

c6c534e825f4a3d41ede3e67473187d1 avatar c6c534e825f4a3d41ede3e67473187d1 commented on September 16, 2024 1

So I guess this issue is now fixed aswell?

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024

same happens for me :(

I have typescript-language-server installed via homebrew, and in my config:

local lspconfig = require "plugins.lsp.config"

lspconfig.tsserver.setup {
  command = {
    '/opt/homebrew/bin/typescript-language-server',
    '--stdio'
  }
}

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

What are the steps to reproduce the issue? Any custom LSP config option, like config.plugins.lsp.more_yielding = true? Does it happen every time?

from lite-xl-lsp.

c6c534e825f4a3d41ede3e67473187d1 avatar c6c534e825f4a3d41ede3e67473187d1 commented on September 16, 2024

My LSP related config:

local lsp = require "plugins.lsp"
local lspconfig = require "plugins.lsp.config"

-- Normally set to false, but now true for testing
config.plugins.lsp.mouse_hover = true

lspconfig.gopls.setup()
lspconfig.pylsp.setup()

Yeah, it happens everytime I hover or I close a file which is in use by a server (a .py or .go file)

from lite-xl-lsp.

c6c534e825f4a3d41ede3e67473187d1 avatar c6c534e825f4a3d41ede3e67473187d1 commented on September 16, 2024

And now it also occurs when opening a file

from lite-xl-lsp.

c6c534e825f4a3d41ede3e67473187d1 avatar c6c534e825f4a3d41ede3e67473187d1 commented on September 16, 2024

Traced the issue to my configuration, something kept crashing it but it wasn't appearing in any logs. I didn't install a key requirement. Fixed it by installing it.

But this should be solved by doing a check if proc is nil before doing anything, and perhaps restart the LSP server if neccesary?

Keeping this open for @sebkolind's problem

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

What's the full backtrace? You can ctrl+click in the Log viewer to copy it.
Is it the same backtrace every time?

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

But this should be solved by doing a check if proc is nil before doing anything, and perhaps restart the LSP server if neccesary?

I'm mostly trying to understand why the server is still being used after it's stopped.
At the moment the only way I was able to reproduce the issue was with config.plugins.lsp.more_yielding = true, so I think I'll investigate that.

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

Traced the issue to my configuration, something kept crashing it but it wasn't appearing in any logs. I didn't install a key requirement. Fixed it by installing it.

What was it? Maybe we can improve logging if it isn't found.

from lite-xl-lsp.

c6c534e825f4a3d41ede3e67473187d1 avatar c6c534e825f4a3d41ede3e67473187d1 commented on September 16, 2024

What was it? Maybe we can improve logging if it isn't found.

PyLSP was missing jedi, all the logs said was pylsp exited, check your config and then pylsp restarted, but it didn't restart, which caused proc to be nil (as the process is dead)

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024

This is the only config that I have:

lspconfig.tsserver.setup {
  command = {
    '/opt/homebrew/bin/typescript-language-server',
    '--stdio'
  }
}

config.plugins.lsp.log_server_stderr = true

and the error that I get is:

Tue Nov  7 20:52:46 2023 [ERROR] /Users/skolind/.config/lite-xl/plugins/lsp/server.lua:1162: attempt to index a nil value (field 'proc') at /Applications/Lite XL.app/Contents/Resources/core/init.lua:1226

stack traceback:
/Users/skolind/.config/lite-xl/plugins/lsp/server.lua:1162: in function 'plugins.lsp.server.read_responses'
/Users/skolind/.config/lite-xl/plugins/lsp/server.lua:721: in function 'plugins.lsp.server.process_responses'
/Users/skolind/.config/lite-xl/plugins/lsp/init.lua:2141: in function </Users/skolind/.config/lite-xl/plugins/lsp/init.lua:2115>
[C]: in function 'xpcall'
/Applications/Lite XL.app/Contents/Resources/core/init.lua:1225: in function 'core.try'
(...tail calls...)


Tue Nov  7 20:52:46 2023 [INFO] [LSP]: typescript-language-server was shutdown, revise your configuration at /Users/skolind/.config/lite-xl/plugins/lsp/init.lua:789

Tue Nov  7 20:52:35 2023 [INFO] [LSP/typescript-language-server]: Error: 
'env: node: No such file or directory
'
 at /Users/skolind/.config/lite-xl/plugins/lsp/init.lua:780

I guess it's the env: node part, but not sure what that means? I am using the LSP in other editors like Zed, Nvim etc.. with no issues.

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

I guess it's the env: node part, but not sure what that means?

Looks like your PATH might not contain node. Looking online this seems to be a common issue on macOS, so it's probably not related to Lite XL and the LSP plugin.

Still, I'm working on solving the attempt to index a nil value part, but that won't solve your tsserver issue.

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024

I guess it's the env: node part, but not sure what that means?

Looks like your PATH might not contain node. Looking online this seems to be a common issue on macOS, so it's probably not related to Lite XL and the LSP plugin.

Still, I'm working on solving the attempt to index a nil value part, but that won't solve your tsserver issue.

My PATH does include node. Again, all other editors work, so not sure why it shouldn't work here?

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

Add this to your user module then check the Logs:

core.log("%s", os.getenv("PATH"))
local np, n_err = process.start({"node", "--version"})
if not np then
  core.log("Unable to start node: %s", n_err)
else
  local buf = {}
  repeat
    local buffer = np:read_stdout()
    if buffer and #buffer > 0 then
      table.insert(buf, buffer)
    end
  until not buffer
  core.log("%s", table.concat(buf))
end

It's very possible that the PATH depends on how you open Lite XL.

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024
core.log("%s", os.getenv("PATH"))
local np, n_err = process.start({"node", "--version"})
if not np then
  core.log("Unable to start node: %s", n_err)
else
  local buf = {}
  repeat
    local buffer = np:read_stdout()
    if buffer and #buffer > 0 then
      table.insert(buf, buffer)
    end
  until not buffer
  core.log("%s", table.concat(buf))
end

I think you are right! It printed out this:

Tue Nov  7 21:26:02 2023 [INFO] /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin at /Users/skolind/.config/lite-xl/init.lua:68

Which is not my PATH specified in .zshrc.

I am opening lite from spotlight. Which seems to not load my PATH correcrtly.

If I run /Applications/Lite\ XL.app/Contents/MacOS/lite-xl in the terminal, it is working and the LSP is loading correctly.

Any ideas how to fix this?

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

I wonder if you could run typescript-language-server from zsh. So something like:

local lspconfig = require "plugins.lsp.config"

lspconfig.tsserver.setup {
  command = {
    'zsh', '-c',
    '/opt/homebrew/bin/typescript-language-server --stdio'
  }
}

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024

I wonder if you could run typescript-language-server from zsh. So something like:

local lspconfig = require "plugins.lsp.config"

lspconfig.tsserver.setup {
  command = {
    'zsh', '-c',
    '/opt/homebrew/bin/typescript-language-server --stdio'
  }
}

Unfortunately, that doesn't seem to make a difference.

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

Same env: node: No such file or directory error?

I guess you could try forcing zsh to source your .zshrc, like:

local lspconfig = require "plugins.lsp.config"

lspconfig.tsserver.setup {
  command = {
    'zsh', '-c',
    'source ~/.zshrc; /opt/homebrew/bin/typescript-language-server --stdio'
  }
}

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024
lspconfig.tsserver.setup {
  command = {
    'zsh', '-c',
    'source ~/.zshrc; /opt/homebrew/bin/typescript-language-server --stdio'
  }
}

Force sourcing .zshrc seems to do the trick. It is a bit hacky however, but I guess it's an issue with how MacOS opens the application?

It seems to work now though, thank you so much!

from lite-xl-lsp.

Guldoman avatar Guldoman commented on September 16, 2024

Force sourcing .zshrc seems to do the trick. It is a bit hacky however, but I guess it's an issue with how MacOS opens the application?

I don't know much about macOS but a similar thing happens in some Linux DEs. There, I know a bunch of ways to make env changes "universal", so maybe there's a macOS way too.

Let me know if with #79 applied, you aren't getting attempt to index a nil value anymore with the "bad" version of the config.

It seems to work now though, thank you so much!

No worries!

from lite-xl-lsp.

sebkolind avatar sebkolind commented on September 16, 2024

Force sourcing .zshrc seems to do the trick. It is a bit hacky however, but I guess it's an issue with how MacOS opens the application?

I don't know much about macOS but a similar thing happens in some Linux DEs. There, I know a bunch of ways to make env changes "universal", so maybe there's a macOS way too.

Let me know if with #79 applied, you aren't getting attempt to index a nil value anymore with the "bad" version of the config.

It seems to work now though, thank you so much!

No worries!

I can't reproduce the issue with a "bad config" anymore. Awesome!

from lite-xl-lsp.

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.