Skip to content

Upgrade dependencies #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/upgrade-tree-sitter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euox pipefail
cd server
pnpm add web-tree-sitter
pnpm add --save-dev tree-sitter-cli https://github.com/tree-sitter/tree-sitter-bash
npx tree-sitter build-wasm node_modules/tree-sitter-bash
npx tree-sitter build --wasm node_modules/tree-sitter-bash

curl 'https://api.github.com/repos/tree-sitter/tree-sitter-bash/commits/master' | jq .commit.url > parser.info
echo "tree-sitter-cli $(cat package.json | jq '.devDependencies["tree-sitter-cli"]')" >> parser.info
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"turndown": "7.1.3",
"vscode-languageserver": "8.0.2",
"vscode-languageserver-textdocument": "1.0.11",
"web-tree-sitter": "0.20.8",
"web-tree-sitter": "0.22.5",
"zod": "3.22.4"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions server/parser.info
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"https://api.github.com/repos/tree-sitter/tree-sitter-bash/git/commits/4488aa41406547e478636a4fcfd24f5bbc3f2f74"
tree-sitter-cli "0.20.7"
"https://api.github.com/repos/tree-sitter/tree-sitter-bash/git/commits/f8fb3274f72a30896075585b32b0c54cad65c086"
tree-sitter-cli "0.22.5"
5 changes: 2 additions & 3 deletions server/src/__tests__/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,6 @@ describe('server', () => {
['variable in let expression', 110, 4],
['variable in binary expression', 111, 9],
['variable in postfix expression', 111, 17],
['variable in arithmetic expansion', 112, 14],
])('returns null for non-renamable symbol: %s', async (_, line, character) => {
expect(await getPrepareRenameResult(line, character)).toBeNull()
})
Expand Down Expand Up @@ -1741,9 +1740,9 @@ describe('server', () => {
describe('Edge or not covered cases', () => {
it('only includes variables typed as variable_name', async () => {
const iRanges = await getFirstChangeRanges(getRenameRequestResult(106, 4))
// This should be 6 if all instances within let and arithmetic
// This should be 6 if all instances within let, postfix, and binary
// expressions are included.
expect(iRanges.length).toBe(2)
expect(iRanges.length).toBe(3)

const lineRanges = await getFirstChangeRanges(getRenameRequestResult(118, 10))
// This should be 2 if the declaration of `line` is included.
Expand Down
2 changes: 1 addition & 1 deletion server/src/analyser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class Analyzer {
})
}

if (tree.rootNode.hasError()) {
if (tree.rootNode.hasError) {
logger.warn(`Error while parsing ${uri}: syntax error`)
}

Expand Down
6 changes: 5 additions & 1 deletion server/src/util/sourcing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ function getSourcedPathInfoFromNode({
}

if (argumentNode.type === 'string' || argumentNode.type === 'raw_string') {
if (argumentNode.namedChildren.length === 0) {
const children = argumentNode.namedChildren
Copy link
Contributor Author

Choose a reason for hiding this comment

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

when argumentNode.text == 'source "./issue206.sh"', argumentNode.namedChildren contains an element that is string_content with text=='"./issue206.sh"'

I am no expert here, so while this does fix it, there may be a better/more robust way to handle this

if (
children.length === 0 ||
(children.length === 1 && children[0].type === 'string_content')
) {
return {
sourcedPath: argumentNode.text.slice(1, -1),
}
Expand Down
Binary file modified server/tree-sitter-bash.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions testing/fixtures/renaming.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ done < somefile.txt

# Complex nesting affects self-assignment handling

1() {
f1() {
local var="var"

2() (
f2() (
var=$var

3() {
f3() {
declare var="$var"
}
)
Expand Down
Loading