lspsaga.nvim icon indicating copy to clipboard operation
lspsaga.nvim copied to clipboard

Winbar(Breadcrumbs) not working as Expected.

Open Tanish2002 opened this issue 1 year ago • 6 comments

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

Tanish2002 avatar Jun 11 '24 10:06 Tanish2002

Can you provide this js code that can reproduce

glepnir avatar Jun 11 '24 11:06 glepnir

@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 avatar Jun 11 '24 13:06 Tanish2002

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

Tanish2002 avatar Jun 11 '24 13:06 Tanish2002

+1

hsayed21 avatar Jun 14 '24 20:06 hsayed21

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,
}

hsayed21 avatar Jun 14 '24 21:06 hsayed21

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

ggeorgiu avatar Jun 28 '24 19:06 ggeorgiu