LuaLS / LuaLS/lua-language-server

"Expand Selection" doesn't expand to strings or scopes

Đang mở
#3,455 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Lua
Star
4.4k
Fork
442
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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 example string " .. 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 example string " + 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 () return true 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần triển khai của Expand Selection và mọi bài kiểm thử bao quát việc mở rộng vùng chọn; issue không nêu tên các tệp hoặc điểm vào cụ thể. Tái hiện các ví dụ về chuỗi Lua, phạm vi hàm và Object.property, sau đó bổ sung coverage cho thấy các lần mở rộng liên tiếp chọn đúng các cấu trúc mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
lua
Lĩnh vực
devtools, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.