LuaLS / LuaLS/lua-language-server
"Expand Selection" doesn't expand to strings or scopes
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
I use VScode's "Expand Selection" command a lot to copy strings around, but when I try to use it on Lua strings, it expands the selection a lot more than just the string I'm on.
Actual behavior
Suppose my cursor is inside the word example:
hs.alert(prefix .. " an exam
|ple string " .. suffix)
1st call to Expand Selection selects the word:
hs.alert(prefix .. " an
examplestring " .. suffix)
2nd call to Expand Selection selects everything between () instead of the full string:
hs.alert(
prefix .. " an example string " .. suffix)
Expected behavior
2nd call to Expand Selection should select just the string:
hs.alert(prefix ..
" an example string ".. suffix)
In JavaScript, I noticed it even has two steps for the string, the inner part of the string, then the outer:
alert(prefix + " an
examplestring " + suffix)
alert(prefix + "
an example string" + suffix)
alert(prefix +
" an example string "+ suffix)
That would also work!
Similar scenarios
Scopes are also currently skipped:
local myFunction = function () ret
|urn true end
local myFunction = function ()
returntrue end <- 1st call selects the word
local myFunction =
function () return true end<- expected: 2nd call selects the function scope
local myFunction = function () return true end<- actual: 2nd call selects the line instead
Same for Object.property:
Object.
property= true
Object.property= true <- expected
Object.property = true<- actual
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 Expand Selection 的实现,以及覆盖选择扩展的所有测试;该 issue 没有指定具体文件或入口点。重现 Lua 字符串、函数作用域和 Object.property 示例,然后添加覆盖测试,以展示连续扩展会选择预期的构造。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 65/100