Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2bde696

Browse files
committed
Remove checks against renaming builtins and executables
1 parent e91761d commit 2bde696

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

‎server/src/server.ts‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -737,31 +737,14 @@ export default class BashServer {
737737
return null
738738
}
739739

740-
if (Builtins.isBuiltin(symbol.word)) {
741-
this.throwResponseError('You cannot rename a built-in command.')
742-
}
743-
744-
if (this.executables.isExecutableOnPATH(symbol.word)) {
745-
this.throwResponseError('You cannot rename an executable.')
746-
}
747-
748-
if (ReservedWords.isReservedWord(symbol.word)) {
749-
this.throwResponseError('You cannot rename a reserved word.')
750-
}
751-
752740
return symbol.range
753741
}
754742

755743
private onRenameRequest(params: LSP.RenameParams): LSP.WorkspaceEdit | null {
756744
const symbol = this.analyzer.symbolAtPointFromTextPosition(params)
757745
this.logRequest({ request: 'onRenameRequest', params, word: symbol?.word })
758746

759-
if (
760-
!symbol ||
761-
Builtins.isBuiltin(symbol.word) ||
762-
this.executables.isExecutableOnPATH(symbol.word) ||
763-
ReservedWords.isReservedWord(symbol.word)
764-
) {
747+
if (!symbol) {
765748
return null
766749
}
767750

@@ -805,8 +788,8 @@ export default class BashServer {
805788
declaration.range.start,
806789
declaration.range.end,
807790
)
808-
// If the symbol is a function, `parentScope` should be a subshell not the
809-
// function definition itself.
791+
// If the symbol is a function, `parentScope` should be a parent function or
792+
// a subshell, not the function definition itself.
810793
if (parentScope?.type === symbol.type) {
811794
parentScope = this.analyzer.findParentScope(
812795
params.textDocument.uri,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /