sourcegraph / sg.nvim

Experimental Sourcegraph + Cody plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sourcegraph commands are missing after exit

hamidreza4dev opened this issue · comments

sg-nvim.mp4

:checkhealth sg before exit:

==============================================================================
sg: require("sg.health").check()

sg.nvim report ~
- Machine: arm64, sysname: Darwin
- OK Valid nvim version: table: 0x010539ff18
- WARNING Unable to find valid cargo executable. Trying to build sg.nvim locally will fail. Instead use `:SourcegraphDownloadBinaries`
- OK Found `sg-nvim-agent`: "/Users/hamidreza4dev/.local/share/nvim/lazy/sg.nvim/dist/sg-nvim-agent"
- OK Found `node` (config.node_executable) is executable.
  Version: '20.11.0'
- OK Found `cody-agent`: /Users/hamidreza4dev/.local/share/nvim/lazy/sg.nvim/dist/cody-agent.js
- OK   Authentication setup correctly
- OK     endpoint set to: https://sourcegraph.com
- OK Found correct binary versions: "1.1.0" = "1.1.0"
- OK   Sourcegraph Connection info: {
  access_token_set = true,
  endpoint = "https://sourcegraph.com",
  sg_nvim_version = "1.1.0",
  sourcegraph_version = {
  build = "267416_2024-04-03_5.3-363bc9682621",
  product = "267416_2024-04-03_5.3-363bc9682621"
  }
  }
- To manage your Cody Account, navigate to: https://sourcegraph.com/cody/manage
- OK Cody Account Information: {
  chat_limit = 0,
  chat_usage = 64,
  code_limit = 0,
  code_usage = 5105,
  cody_pro_enabled = true,
  username = "hamidreza4dev"
  }
- OK sg.nvim is ready to run

:checkhealth sg after exiting neovim:

sg: 

- ERROR No healthcheck found for "sg" plugin.

after exiting neovim I cant access to sourcegraph commands like SourcegraphLogin or SourcegraphDownloadBinaries

Logs:

[ERROR Thu Apr  4 12:57:02 2024] /Users/hamidreza4dev/.local/share/nvim/lazy/sg.nvim/lua/sg/vendored/vim-lsp-rpc.lua:211: client_error: INVALID_SERVER_MESSAGE {
  code = 1,
  message = "Failed to discover repo: Failed to access a directory, or path is not a directory: ''"
}

Can you try again with nvim 0.10 and latest plugin? I have pushed some updates that should help with this situation

Previously, I used NvChad for my configuration, but the problem disappeared after I switched from it. I also tested my previous configuration, and the problem persisted. However, you can review my configuration here.

I'm having the same problem too.. I'm using LazyVim
For me I have to call :CodyChat or any Cody command so that sg.nvim will be enabled and after that I can already use it again but when I exit neovim I have to do it again. I thought it was just me.

I've had the same problem and just resolved it by deactivating lazy loading for the sg.nvim plugin.

 {
    "sourcegraph/sg.nvim",
    lazy = false,
    dependencies = "nvim-lua/plenary.nvim",
    config = function()
      require("sg").setup()
    end,
  },

So the issue was that sg.nvim just wouldn't load at startup. I have no idea whether there are any triggers that would load the plugin at runtime though.