Closed Wjinlei closed 1 year ago
That certainly sounds like a bug. Could you provide a minimal sample file that exhibits this problem?
Also, I assume that you're using vuels as your language server?
@stevearc Configuration file as above, I bind the key is
vim.keymap.set("n", "<C-m>", "<cmd>AerialToggle!<CR>", { buffer = bufnr })
vim.keymap.set("n", "<C-k>", "<cmd>lua require('aerial').prev()<CR>", { buffer = bufnr })
vim.keymap.set("n", "<C-j>", "<cmd>lua require('aerial').next()<CR>", { buffer = bufnr })
Here's a demo
As you can see, when I press Ctrl+k, everything works fine, but when I press Ctrl+j, it doesn't seem to work.
The lsp server I use is volar
I meant can you provide a minimal .vue
file. I don't use vue or volar and it will be easier for me to repro this if I don't have to first figure out how to set up a vue project. Also there will be fewer differences between our two setups when I test it.
@stevearc This is a demo vue file
<template>
<h1>Hello {{ world }}</h1>
</template>
<script>
export default {
name: 'Demo',
data() {
return {
world: 'vue'
}
}
}
</script>
@stevearc Here's another one
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
<script src="https://unpkg.com/vue@3.2.31/dist/vue.global.js"></script> <!-- 引入Vue3 -->
</head>
<body>
<div id="app">
<h1>Hello {{ lanuage }}</h1>
</div>
</body>
<script>
const app = Vue.createApp({
data() {
return {
lanuage: "Vue"
}
}
})
const vm = app.mount("#app")
</script>
</html>
Ugh, as expected this is because volar is giving...if not incorrect symbol ranges, then at least surprising ones. The starting column of the symbols is off the end of the line, which means that it's impossible for us to ever be exactly on that symbol and that generally creates issues (navigation being the most obvious).
I've added a hack that should work around this, but the real solution is for the language server to produce correct symbol positions. I've reported this upstream https://github.com/johnsoncodehk/volar/issues/2118
@stevearc Thank you, it's working fine now, hopefully upstream can fix it too
Describe the bug
I'm not sure if it's a bug, but it's really weird next() and next_up() do not jump to the next tag in the vue file, prev() and prev_up() are fine,
System information
Aerial config: