Comments (6)
Can we reopen this please?
This is sensitive to updatetime
. I can reproduce this with updatetime=100
and holding on an intermediate line for more than 100ms.
FWIW, disabling the CursorHold
autocmd fixes it, but this is obviously undesireable (autocmd! context_commentstring_ft CursorHold
)
from nvim-ts-context-commentstring.
Hey @defpis! I can't quite reproduce this:
Screen.Recording.2023-09-12.at.21.56.21.mov
What exact keys are you pressing for the examples?
Could you create a minimal reproducible config using the minimal config? https://github.com/JoosepAlviste/nvim-ts-context-commentstring/blob/9bff161dfece6ecf3459e6e46ca42e49f9ed939f/utils/minimal_init.lua
from nvim-ts-context-commentstring.
Thanks for taking the time to check out the problem, any help would be appreciated.
There is minimal config:
local options = { -- :help options
backup = false, -- Don't create a backup file
clipboard = 'unnamedplus', -- Allow NeoVim to access system clipboard
conceallevel = 0, -- Make `` visible in Markdown files
fileencoding = 'utf-8', -- Use `utf-8` as encoding
hlsearch = true, -- Highlight all matches on previous search pattern
ignorecase = true, -- Ignore case in search patterns
mouse = 'a', -- Allow the mouse to be used in NeoVim
showmode = false, -- Hide NeoVim modes in the status bar
showtabline = 2, -- Always show tabs
smartcase = true, -- Ignore `ignorecase` if search pattern contains upper case characters
smartindent = true, -- Make indenting smarter on newline
splitbelow = true, -- Force all horizontal splits to go below current window
splitright = true, -- Force all vertical splits to go to the right of current window
swapfile = false, -- Don't create a swapfile
termguicolors = true, -- Set term gui colors
timeoutlen = 1000, -- Time to wait for a mapped sequence to complete (in milliseconds)
updatetime = 300, -- Faster completion (4000ms default)
writebackup = false, -- If a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- Convert tabs to spaces
shiftwidth = 2, -- The number of spaces inserted for each indentation
tabstop = 2, -- Insert 2 spaces for a tab
cursorline = true, -- Highlight the current line
cursorlineopt = 'number', -- Hightlight the current line number
number = true, -- Set numbered lines
relativenumber = true, -- Set relative numbered lines
signcolumn = 'yes', -- Always show the sign column, otherwise it would shift the text each time
wrap = false, -- Display long lines as one
scrolloff = 8, -- Minimal number of screen lines to keep above and below the cursor
sidescrolloff = 8, -- Minimal number of screen columns to keep left and right the cursor
cmdheight = 1, -- More space in the neovim command line for displaying messages
pumheight = 10, -- Make popup menu smaller
background = 'dark', -- Tell NeoVim what the background color is
laststatus = 3, -- Use global statusline
}
for key, value in pairs(options) do
vim.opt[key] = value
end
local lazy_path = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazy_path) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazy_path,
})
end
vim.opt.rtp:prepend(lazy_path)
require('lazy').setup({
{
'gbprod/yanky.nvim',
config = function()
require('yanky').setup({
preserve_cursor_position = { enabled = true },
highlight = { on_put = false, on_yank = false },
})
end,
},
{
'phaazon/hop.nvim',
branch = 'v2',
config = function()
require('hop').setup({ keys = 'etovxqpdygfblzhckisuran' })
end,
},
-- {
-- 'numToStr/Comment.nvim',
-- config = function()
-- require('Comment').setup()
-- -- local ft = require('Comment.ft')
-- -- ft.set('json', { '// %s', '/* %s */' })
-- end,
-- },
{
'kylechui/nvim-surround',
config = function()
require('nvim-surround').setup()
end,
},
{ 'nvim-treesitter/nvim-treesitter-textobjects', dependencies = { 'nvim-treesitter' } },
{
'nvim-treesitter/nvim-treesitter',
dependencies = { 'JoosepAlviste/nvim-ts-context-commentstring' }, -- FIXME: May cause j/k position incorrect
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = {
'lua',
'typescript',
'tsx',
'javascript',
'html',
'css',
'scss',
'json',
'jsonc',
'yaml',
'markdown',
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<Leader><CR>',
node_incremental = '<CR>',
node_decremental = '<BS>',
scope_incremental = '<Leader><CR>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['af'] = '@function.outer',
['if'] = '@function.inner',
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
},
},
},
context_commentstring = { enable = true },
})
end,
},
})
both terminal and vscode cursor can't move correct position.
from nvim-ts-context-commentstring.
Thanks for the minimal config!
I tried it out, but still can't reproduce the issue:
Screen.Recording.2023-09-28.at.22.22.57.mov
To be honest, I don't have any ideas as to what might be going wrong 😕 Maybe we could get someone else to try to reproduce it?
I don't think that this plugin should affect j
/k
in any way as it just sets up an autocommand on CursorHold
and that's it. Maybe there's something outside of Vim that's affecting it somehow?
from nvim-ts-context-commentstring.
Thank you. There may be a problem with my computer environment. I try to find the reason by myself, I close this issue.
from nvim-ts-context-commentstring.
I was able to reproduce this now, when using the CursorHold
autocommand. It looks like setting an option inside CursorHold
is causing the issue, e.g., here:
I did a quick search, but couldn't find any other issues or questions about this behaviour, so I unfortunately don't have a good solution for this yet.
I can recommend using a commenting plugin integration, though, and disabling the autocommand like described in the integrations wiki page: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/wiki/Integrations
from nvim-ts-context-commentstring.
Related Issues (20)
- Svelte only returns html-comment for all locations HOT 2
- Need help in debugging strange situation HOT 1
- Work-around to make this work with native comments in Neovim 0.10 HOT 4
- Incorrect commentstring for erb tags on eruby files
- Incorrect commentstring inside <?php ?> tags HOT 1
- Does not seems to work on html files like shown in the doc
- Does this work well when nvim-treesitter 1.0 is out? HOT 4
- tsx is not properly commenting HOT 8
- Vue comment not working properly HOT 2
- This plugin doesn't set the `comments` var. HOT 2
- BREAKING CHANGES HOT 6
- Incorrent commentstring for inline markdown code blocks HOT 4
- `set ft?` return `filetype=on` and causing losing syntax highlighting HOT 5
- Commenting is slow in large Markdown files HOT 3
- context_commentstring nvim-treesitter module is deprecated HOT 2
- tsx is not properly commenting even when ts-context-commentstring works HOT 1
- Please do not create unnecessary global variables
- Vue comment js/ts using html comment tags HOT 2
- Doesn't work ootb with mini.comment / Comment.nvim (React) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-ts-context-commentstring.