nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.36k stars 283 forks source link

Winbar(Breadcrumbs) not working as Expected. #1463

Open Tanish2002 opened 3 weeks ago

Tanish2002 commented 3 weeks ago

Describe the bug

The winbar provided by lspsaga only contains the File path. And not the lsp related symbols(functions, classes, etc) I tried navic and that seems to work fine, However I would like to use LspSaga for this since it provides nice highlighting..

Attaching some screenshots for your reference: LspSaga: image

Navic: image

Both screenshots are taken inside the same file and same function scope

Steps to reproduce

Relevant Config:

require("lspsaga").setup({})

Expected behavior

Lspsaga shows function name as well as folder and file in winbar.

Neovim version (nvim -v)

v0.9.5

lspsaga commit

-

Terminal name/version

st

glepnir commented 3 weeks ago

Can you provide this js code that can reproduce

Tanish2002 commented 3 weeks ago

@glepnir

I can't provide the exact code since it's confidential company code.. But here is a small reproduction of the same:

var Q = require('q');
var md5 = require('md5');
var Utils = require('../../../../lib/common-utils');
var QuotesValidator = require('../validation/QuotesValidation');
var PolicyCasesController = require('../../../common/controllers/PolicyCasesController');
let CommonController = require('../../../common/controllers/CommonController');
var WinstonLogUtils = require('../../../../lib/winston-log-utils');
let fwService = require('../services/fw_services');
let mySqlCommonService = require('../../../common/services/MySqlCommonService');
let Guid = require('guid');
let request = require('request');

var quotesRedis = require('../../../../lib/quotes-redis-connection');

function Quotes() {

  this.quotes = {};
  this.errors = {};
}

Quotes.prototype.getQuotes = async function(req, res) {
  // some code 
  //
}

// some more very legacy code.. :<

module.exports = Quotes;
Tanish2002 commented 3 weeks ago

Just found that it seems to work but weirdly,

for example If I keep my cursor over PolicyCasesController or WinstonLogUtils it shows them in winbar, but not for any of the other imports or functions..

Screenshots: image image

Not working: image

hsayed21 commented 3 weeks ago

+1

hsayed21 commented 3 weeks ago

For me working goods with some languages and not for others.

Can someone explain why nvimdev/lspsaga.nvim not working with certain languages ?
Although I have installed LSP and tree-sitter and it works perfectly for text objects and syntax highlighting.

For Example: this working fine with lua image

and this not working with C# (always appear the file path) image

Neovim version:

3

MyConfig:

{
    "nvim-lualine/lualine.nvim",
    dependencies = 
    { 
        {
            "nvim-tree/nvim-web-devicons"
        },
        {
            "nvimdev/lspsaga.nvim",
            event = { "LspAttach" },
            dependencies = {
                "neovim/nvim-lspconfig",
                "nvim-treesitter/nvim-treesitter",
            },
        }
    },
    config = function()
        local lualine = require("lualine")
        local lazy_status = require("lazy.status") -- to configure lazy pending updates count

        local lspsaga = require('lspsaga')
        lspsaga.setup({})
        local lspsaga_bar = require("lspsaga.symbol.winbar")

        local function breadcrumbs()
            local bar = lspsaga_bar.get_bar()
            if bar == nil then
                return ""
            end
            return bar
        end

        lualine.setup({
            options = {
                theme = "catppuccin",
                section_separators = { left = "", right = "" },
                component_separators = { left = "", right = ""},
            },
            icons_enabled = true,
            tabline = {},
            globalstatus = true,
            sections = {
                lualine_a = { 'mode' },
                lualine_b = { 'branch', 'diff', 'diagnostics' },
                lualine_c = { 'filename' },
                lualine_x = {
                    {
                        lazy_status.updates,
                        cond = lazy_status.has_updates,
                        color = { fg = "#ff9e64" }
                    },
                    { "encoding" },
                    { "fileformat" },
                    { "filetype" },
                },
                lualine_y = { 'progress', 'searchcount' },
                lualine_z = { 'location' }
            },
            inactive_sections = {
                lualine_a = {},
                lualine_b = {},
                lualine_c = { 'filename' },
                lualine_x = { 'location' },
                lualine_y = {},
                lualine_z = {}
            },
            winbar = {
                lualine_a = {},
                lualine_b = {},
                lualine_c = { breadcrumbs },
                lualine_x = {},
                lualine_y = {},
                lualine_z = {}
            },
            inactive_winbar = {
                lualine_a = {},
                lualine_b = {},
                lualine_c = { breadcrumbs },
                lualine_x = {},
                lualine_y = {},
                lualine_z = {}
            },
            extensions = {}
        }
    )
    end,
}
ggeorgiu commented 1 week ago

I'm experiencing a similar issue. I noticed that the breadcrumbs are consistently not appearing on the first file opened whenever starting nvim. It works fine for the rest.

Not working:

Screenshot 2024-06-28 at 22 07 46

Working:

Screenshot 2024-06-28 at 22 08 02 Screenshot 2024-06-28 at 22 08 31

Note: autocmds.lua is the first file I opened. If I close nvim, re-open it and open globals.lua first the breadcrumbs are not working in that file.

Ex:

Screenshot 2024-06-28 at 22 12 52 Screenshot 2024-06-28 at 22 13 27 Screenshot 2024-06-28 at 22 13 43