Skip to content

Commit

Permalink
feat: add support for rename prefixText and suffixText on rename (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackieaskins committed Jun 6, 2022
1 parent b8eb218 commit b3c8535
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ From the `preferences` options listed above, this server explicilty sets the fol
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
jsxAttributeCompletionStyle: "auto",
providePrefixAndSuffixTextForRename: true,
}
```

Expand Down
3 changes: 2 additions & 1 deletion src/lsp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class LspServer {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
jsxAttributeCompletionStyle: 'auto',
providePrefixAndSuffixTextForRename: true,
...userInitializationOptions.preferences
}
};
Expand Down Expand Up @@ -679,7 +680,7 @@ export class LspServer {

spanGroup.locs.forEach((textSpan) => {
textEdits.push({
newText: params.newName,
newText: `${textSpan.prefixText || ''}${params.newName}${textSpan.suffixText || ''}`,
range: {
start: toPosition(textSpan.start),
end: toPosition(textSpan.end)
Expand Down

0 comments on commit b3c8535

Please sign in to comment.