Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to enable virtual text #23

Open
Davincible opened this issue Oct 25, 2022 · 10 comments
Open

[Question] How to enable virtual text #23

Davincible opened this issue Oct 25, 2022 · 10 comments

Comments

@Davincible
Copy link
Contributor

Am I supposed to see virtual text like shown in the readme? I am only seeing the icon for passed/failed as virtual text

image

@akinsho
Copy link
Collaborator

akinsho commented Oct 26, 2022

@Davincible have you added

    diagnostic = {
      enabled = true,
    },

To your neotest config?

@akinsho akinsho changed the title Virtual text? [Question] How to enable virtual text Oct 26, 2022
@Davincible
Copy link
Contributor Author

Yup.

Config:

local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
	virtual_text = {
		format = function(diagnostic)
			local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
			return message
		end,
	},
}, neotest_ns)

local neotest = require("neotest")

neotest.setup({
	diagnostic = {
		enabled = true,
	},
	status = {
		virtual_text = true,
		signs = true,
	},
	strategies = {
		integrated = {
			width = 180,
		},
	},
	icons = {
		running_animated = {
			"",
			"🞅",
			"🞈",
			"🞉",
			"",
			"",
			"🞉",
			"🞈",
			"🞅",
			"",
		},
	},
	adapters = {
		require("neotest-go")({
			args = { "-count=1", "-timeout=60s", "-race", "-cover" },
		}),
		require("neotest-python")({
			dap = { justMyCode = false, console = "integratedTerminal" },
		}),
	},
})

@akinsho
Copy link
Collaborator

akinsho commented Oct 26, 2022

I'm able to see virtual text but to be clear it only appears when a test has been run and has failed, otherwise there will be no virtual text. It isn't really controlled here, but in neotest itself. Are you able to see virtual text with any adapters? If not, this is likely a config issue but at worst an issue there rather than here since this plugin doesn't do any logic to enable or disable the virtual text.

@Davincible
Copy link
Contributor Author

I do see virtual text, but only icons. Could you make a screenshot with how it looks for you?

image

Some code to test;

func TestSuite(t *testing.T) {
	t.Run("TestOne", testOne)
	t.Run("TestTwo", func(t *testing.T) {})
	t.Run("TestThree", func(t *testing.T) {})
}

func testOne(t *testing.T) {
	t.Fatal("Yiiikes")
}

@akinsho
Copy link
Collaborator

akinsho commented Oct 26, 2022

image

The message is quite long, so you can't see much of it, but the red text is the message of the full thing 🤷🏿‍♂️. Maybe try a more minimal configuration. Anyway, I'll leave further debugging to you +/- anyone else who wants to pitch in.

@Davincible
Copy link
Contributor Author

Hm strange. Thanks

@Davincible
Copy link
Contributor Author

Side note; I do see them with python, which I why I asked here

image

@nshen
Copy link

nshen commented Nov 22, 2022

no virtual text display

image

@franroa
Copy link

franroa commented May 22, 2023

I have the same issue over here, I can only see icons. Could it be the golang version? I am using the 1.20.4. Neovim version: 0.9 2.1.0-beta3

@Thevetat
Copy link

Thevetat commented Jul 5, 2023

Likewise only seeing icons.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants