Skip to content

Commit 2959c58

Browse files
committed
feat: bump stack-graphs forked version & update tests
1 parent 28739d9 commit 2959c58

File tree

5 files changed

+23
-40
lines changed

5 files changed

+23
-40
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stack-graphs-python-bindings"
3-
version = "0.0.11"
3+
version = "0.0.12"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -10,13 +10,13 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
pyo3 = "0.20.0"
13-
stack-graphs = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2", features = [
13+
stack-graphs = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1", features = [
1414
"storage",
1515
] }
16-
tree-sitter-stack-graphs = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2", features = [
16+
tree-sitter-stack-graphs = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1", features = [
1717
"cli",
1818
] }
19-
tree-sitter-stack-graphs-java = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2" }
20-
tree-sitter-stack-graphs-javascript = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2" }
21-
tree-sitter-stack-graphs-python = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2" }
22-
tree-sitter-stack-graphs-typescript = { git = "https://github.com/nohehf/stack-graphs.git", rev = "9551ad995c79277d950ac2e0d5d9a2d5e42631e2" }
19+
tree-sitter-stack-graphs-java = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1" }
20+
tree-sitter-stack-graphs-javascript = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1" }
21+
tree-sitter-stack-graphs-python = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1" }
22+
tree-sitter-stack-graphs-typescript = { git = "https://github.com/nohehf/stack-graphs.git", rev = "41c9515b4f25b70e1e39526cd4c30c41988337c1" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const foo = "bar"
8888
## Known stack-graphs / tree-sitter issues
8989

9090
- Python: module resolution / imports seems to be broken: <https://github.com/github/stack-graphs/issues/430>
91-
- Typescript: module resolution doesn't work with file extensions (eg. `import { foo } from "./module"` is ok, but `import { foo } from "./module.ts"` is not). **An issue should be opened on the stack-graphs repo**. See: `tests/ts_ok_test.py`
91+
- Typescript: module resolution doesn't work with file extensions (eg. `import { foo } from "./module"` is ok, but `import { foo } from "./module.ts"` is not). **PR opened, fixed on the fork**. See: `tests/ts_ok_test.py`
9292
- Typescript: tree-sitter-typescript fails when passing a generic type to a decorator: <https://github.com/tree-sitter/tree-sitter-typescript/issues/283>
9393

9494
## Development

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ classifiers = [
1010
"Programming Language :: Python :: Implementation :: CPython",
1111
"Programming Language :: Python :: Implementation :: PyPy",
1212
]
13-
version = "0.0.11"
13+
version = "0.0.12"
1414
[tool.maturin]
1515
features = ["pyo3/extension-module"]

tests/ts_ok_test.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
1717
"""
1818

19-
# Stack graphs will fail on this: TODO(@nohehf): Open issue
2019
code2 = """
2120
;---index.ts---
2221
import { foo } from "./module.js";
@@ -31,7 +30,6 @@
3130
3231
"""
3332

34-
# Stack graphs will fail on this: TODO(@nohehf): Open issue
3533
code3 = """
3634
;---index.ts---
3735
import { foo } from "./module.ts";
@@ -40,30 +38,15 @@
4038
^{query}
4139
console.log(baz);
4240
43-
;---module.js---
41+
;---module.ts---
4442
export const foo: string = "42";
4543
^{ref2}
4644
4745
"""
4846

4947

5048
def test_ts_ok() -> None:
51-
with string_to_virtual_files(code1) as (dir, positions):
52-
db_path = os.path.join(dir, "db.sqlite")
53-
dir = os.path.abspath(dir)
54-
indexer = Indexer(db_path, [Language.TypeScript])
55-
indexer.index_all([dir])
56-
querier = Querier(db_path)
57-
source_reference = positions["query"]
58-
results = querier.definitions(source_reference)
59-
assert len(results) == 2
60-
expected = [positions["ref1"], positions["ref2"]]
61-
for i, result in enumerate(results):
62-
assert result == expected[i]
63-
64-
65-
def test_ts_fails_should_be_ok() -> None:
66-
for code in [code2, code3]:
49+
for code in [code1, code2, code3]:
6750
with string_to_virtual_files(code) as (dir, positions):
6851
db_path = os.path.join(dir, "db.sqlite")
6952
dir = os.path.abspath(dir)
@@ -72,7 +55,7 @@ def test_ts_fails_should_be_ok() -> None:
7255
querier = Querier(db_path)
7356
source_reference = positions["query"]
7457
results = querier.definitions(source_reference)
75-
assert (
76-
len(results) == 1
77-
) # It should be 2, and find the ref2, but the module resolution doesn't work with file extensions
78-
assert results[0] == positions["ref1"]
58+
assert len(results) == 2
59+
expected = [positions["ref1"], positions["ref2"]]
60+
for i, result in enumerate(results):
61+
assert result == expected[i]

0 commit comments

Comments
 (0)