Skip to content

Commit

Permalink
2.1.1 fix #11 line number off by 1
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhoujx committed Oct 26, 2024
1 parent 4c67da9 commit 6ef6cc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [2.1.1] - 2024-10-25

- fix issue [#11](https://github.com/wenhoujx/swiper/issues/11), wrong line number display, off by 1

## [2.1.0] - 2024-04-19

### Changed
Expand Down
4 changes: 2 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ function _search(searchStr, pick) {

const doc = vscode.window.activeTextEditor.document
pick.items = items.map(match => ({
label: `${_leftPad(match.line)}: ${searchStr} `,
label: `${_leftPad(match.line+1)}: ${searchStr} `,
// IMPORTANT: set description forces vscode quickpick to match the description
// instead of the line content itself.
// otherwise quickpick filters to nothing.
description: `${doc.lineAt(match.line).text}`,
description: `${doc.lineAt(match.line+1).text}`,
...match
}))
if (state.lastValue === searchStr && state.lastSelected) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "swiper",
"displayName": "swiper",
"description": "Emacs style swiper fuzzy search buffer/window",
"version": "2.1.0",
"version": "2.1.1",
"publisher": "wenhoujx",
"author": {
"name": "Wenshuai Hou",
Expand Down

1 comment on commit 6ef6cc6

@cvzakharchenko
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Now, line number is correct, but the text in the description is from the next line.
Image

Please sign in to comment.