8000 lsif -> scip (#42) · nejch/scip-python@051af0c · GitHub
[go: up one dir, main page]

Skip to content

Commit 051af0c

Browse files
authored
lsif -> scip (sourcegraph#42)
rewrote a lot of the tree visitor code. It is now much more focused on using visitName and getScipSymbol rather than having some items made in other visitors. In general, if a visitor does usesful work, then it should return false and handle all the cases itself (which is now the way that each of the visitors work). Some future work is still required to untangle a bit of the complexity for determining how a particular symbol is created as well as adding some debug capabilities to search for how a particular symbol is generated. Also: - fixed a bunch of bugs with imports and references across files / projects - added a dockerfile for autoindexing (will be published on next release) - use `scip` instead of `lsif` for names now - update `scip` library - add `external_symbols` support for snapshot formatter (and correspondingly the support for actually generated external_symbols for builtin types). - In general, we do not generate external_symbols for non-builtin types at this time because we trust that those will get autoindexed in the future.
1 parent 587907e commit 051af0c

File tree

53 files changed

+1604
-1154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1604
-1154
lines changed

.github/workflows/scip-release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13+
- uses: docker/setup-buildx-action@v1
1314
- uses: actions/setup-node@v2
1415
with:
1516
node-version: 16
@@ -19,3 +20,15 @@ jobs:
1920
- run: cd ./packages/pyright-scip/ && npm publish --access public
2021
env:
2122
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
23+
- name: Login to DockerHub
24+
uses: docker/login-action@v1
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
- name: Build and push
29+
id: docker_build_autoindex
30+
uses: docker/build-push-action@v2
31+
with:
32+
file: Dockerfile.autoindex
33+
push: true
34+
tags: sourcegraph/scip-python:autoindex

Dockerfile.autoindex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM nikolaik/python-nodejs:python3.10-nodejs16-alpine@sha256:ee162a5bed4b1550a469d16cbbfe99b63132c2cbc0ff2d0eaccca2bed3c3bfa8
2+
3+
RUN apk add --no-cache git bash curl
4+
RUN npm install -g @sourcegraph/scip-python @sourcegraph/src
5+
6+
CMD ["/bin/sh"]

packages/pyright-scip/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import sqlparse
2+
3+
print(sqlparse.format)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# < definition scip-python python snapshot-util 0.1 /__init__:
2+
#documentation (module)
3+
4+
import sqlparse
5+
# ^^^^^^^^ reference sqlparse 0.4.2 sqlparse/__init__:
6+
7+
print(sqlparse.format)
8+
#^^^^ reference python-stdlib 3.10 builtins/__init__:print().
9+
#external documentation ```python
10+
# > (function)
11+
# > print(*values: object, sep: str | None =...
12+
# >
13+
# > print(*values: object, sep: str | None =...
14+
# > ```
15+
# ^^^^^^^^ reference sqlparse 0.4.2 sqlparse/__init__:
16+
# ^^^^^^ reference local 0
17+
# documentation ```python
18+
# > def format(
19+
# > sql,
20+
# > encoding=None,
21+
# > **options
22+
# > ): # -> str:
23+
# > ```
24+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sqlparse==0.4.2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import re
2+
from typing import Callable, Match, Optional
3+
4+
print(re, Callable, Match, Optional)

packages/pyright-scip/snapshots/input/comprehensions/comp.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
def something(x):
22
return 2 * x
3+
34
_ = [x for x in "should be local 0"]
45
_ = [something(x) for x in "should be local 1"]
6+
_ = [something(x) for x in "should be local 2" if x == "s"]
7+
_ = {k: x for (k, x) in enumerate(range(10))}
8+
9+
10+
asdf = (var for var in [1, 2, 3] if var % 2 == 0)
11+
for var in asdf:
12+
print(var)
513

614
# TODO: ListComprehensions with if
715
# TODO: Dictionary comprehensions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
class SuchNestedMuchWow:
22
class_item: int = 42
3+
4+
class AnotherNestedMuchWow:
5+
other_item: int = 42
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from foo.bar import InitClass
2-
from foo.bar.baz.mod import SuchNestedMuchWow
2+
from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow
33

44
print(SuchNestedMuchWow().class_item)
5+
print(AnotherNestedMuchWow().other_item)
56
print(InitClass().init_item)

0 commit comments

Comments
 (0)
0