Skip to content

Commit ed3f29f

Browse files
authored
Make it possible to use the LSP to talk to Jedi (microsoft#13855)
* Ship language server too * Remove all jedi code and make copy of LS activation * Compiling but not working * Working with intellisense * Enable the experiment in order to switch * Fix up registration so LSP works * Fix version reading * Write test wrapper to try out lsp * Let experiments be in a workspace * Support installing jedi-language-server from custom fork * Fix sonar problems * More sonar fixes - dupe code * Put back the package json changes * Skip dupe checking for language server proxy classes
1 parent 5a0ef97 commit ed3f29f

30 files changed

Lines changed: 694 additions & 48 deletions

‎.github/workflows/insiders.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jobs:
179179

180180
- name: Install Python requirements
181181
run: |
182-
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt
182+
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user
183183
# We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase.
184184
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
185185

‎.sonarcloud.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sonar.sources=src/client,src/datascience-ui
22
sonar.exclusions=src/datascience-ui/**/codicon*.*
33
sonar.tests=src/test
44
sonar.cfamily.build-wrapper-output.bypass=true
5-
sonar.cpd.exclusions=src/datascience-ui/**/redux/actions.ts,src/client/**/raw-kernel/rawKernel.ts,src/client/datascience/jupyter/*ariable*.ts
5+
sonar.cpd.exclusions=src/datascience-ui/**/redux/actions.ts,src/client/**/raw-kernel/rawKernel.ts,src/client/datascience/jupyter/*ariable*.ts,src/client/activation/**/*.ts

‎.vscode/launch.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@
131131
"preLaunchTask": "Compile",
132132
"skipFiles": ["<node_internals>/**"]
133133
},
134+
{
135+
"name": "Jedi LSP tests",
136+
"type": "extensionHost",
137+
"request": "launch",
138+
"runtimeExecutable": "${execPath}",
139+
"args": [
140+
"${workspaceFolder}/src/test",
141+
"--disable-extensions",
142+
"--extensionDevelopmentPath=${workspaceFolder}",
143+
"--extensionTestsPath=${workspaceFolder}/out/test"
144+
],
145+
"env": {
146+
"VSC_PYTHON_CI_TEST_GREP": "Language Server:"
147+
},
148+
"stopOnEntry": false,
149+
"sourceMaps": true,
150+
"outFiles": ["${workspaceFolder}/out/**/*.js", "!${workspaceFolder}/**/node_modules**/*"],
151+
"preLaunchTask": "preTestJediLSP",
152+
"skipFiles": ["<node_internals>/**"]
153+
},
134154
{
135155
"name": "Tests (DataScience, *.ds.test.ts)",
136156
"type": "extensionHost",

‎.vscode/tasks.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
"build/debug/replaceWithWebBrowserPanel.js"
5656
],
5757
"problemMatcher": []
58+
},
59+
{
60+
"type": "npm",
61+
"script": "preTestJediLSP",
62+
"problemMatcher": [],
63+
"label": "preTestJediLSP"
5864
}
5965
]
6066
}

‎.vscodeignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ pythonFiles/lib/**/*.dist-info/**
103103
pythonFiles/lib/**/*.egg-info/**
104104
pythonFiles/lib/python/bin/**
105105
pythonFiles/tests/**
106-
requirements.txt
107106
scripts/**
108107
src/**
109108
test/**

‎package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,7 @@
21082108
"DeprecatePythonPath - experiment",
21092109
"RunByLine - experiment",
21102110
"tryPylance",
2111+
"jediLSP",
21112112
"All"
21122113
]
21132114
},
@@ -2132,6 +2133,7 @@
21322133
"DeprecatePythonPath - experiment",
21332134
"RunByLine - experiment",
21342135
"tryPylance",
2136+
"jediLSP",
21352137
"All"
21362138
]
21372139
},
@@ -3458,6 +3460,8 @@
34583460
"test:cover:report": "nyc --nycrc-path build/.nycrc report --reporter=text --reporter=html --reporter=text-summary --reporter=cobertura",
34593461
"testDebugger": "node ./out/test/testBootstrap.js ./out/test/debuggerTest.js",
34603462
"testSingleWorkspace": "node ./out/test/testBootstrap.js ./out/test/standardTest.js",
3463+
"preTestJediLSP": "node ./out/test/languageServers/jedi/lspSetup.js",
3464+
"testJediLSP": "node ./out/test/languageServers/jedi/lspSetup.js && cross-env CODE_TESTS_WORKSPACE=src/test VSC_PYTHON_CI_TEST_GREP='Language Server:' node ./out/test/testBootstrap.js ./out/test/standardTest.js && node ./out/test/languageServers/jedi/lspTeardown.js",
34613465
"pretestDataScience": "node ./out/test/datascience/dsTestSetup.js",
34623466
"testDataScience": "cross-env CODE_TESTS_WORKSPACE=src/test/datascience VSC_PYTHON_CI_TEST_VSC_CHANNEL=insiders TEST_FILES_SUFFIX=ds.test VSC_PYTHON_FORCE_LOGGING=1 VSC_PYTHON_LOAD_EXPERIMENTS_FROM_FILE=true node ./out/test/testBootstrap.js ./out/test/standardTest.js",
34633467
"testMultiWorkspace": "node ./out/test/testBootstrap.js ./out/test/multiRootTest.js",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import re
2+
import sys
3+
import os
4+
5+
# Add the lib path to our sys path so jedi_language_server can find its references
6+
EXTENSION_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7+
sys.path.append(os.path.join(EXTENSION_ROOT, "pythonFiles", "lib", "python"))
8+
9+
from jedi_language_server.cli import cli
10+
11+
# Trick language server into thinking it started from 'jedi-language-server.exe'
12+
sys.argv[0] = "jedi-language-server.exe"
13+
sys.exit(cli())

‎requirements.in‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# IntelliSense
2-
jedi==0.17.2
1+
# This file is used to generate requirements.txt.
2+
# To update requirements.txt, run the following commands.
3+
# 1) pip install pip-tools
4+
# 2) pip-compile requirements.in
5+
6+
# IntelliSense. This is a specific commit id of our fork of the pappasam jedi-language-server
7+
# If you make fixes to the fork, update the commit id here.
8+
# Note: This pulls in Jedi too but the pypi version.
9+
git+git://github.com/vscode-python/jedi-language-server@42823a2598d4b6369e9273c5ad237a48c5d67553
310
# Sort Imports
411
isort==5.5.2; python_version >= '3.6'
512
# DS Python daemon

‎requirements.txt‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,13 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# pip-compile --generate-hashes
5+
# pip-compile requirements.in
66
#
7-
future==0.18.2 \
8-
--hash=sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d \
9-
# via python-jsonrpc-server
10-
isort==5.5.2 ; python_version >= "3.6" \
11-
--hash=sha256:171c5f365791073426b5ed3a156c2081a47f88c329161fd28228ff2da4c97ddb \
12-
--hash=sha256:ba91218eee31f1e300ecc079ef0c524cea3fc41bfbb979cbdf5fd3a889e3cfed \
13-
# via -r requirements.in
14-
jedi==0.17.2 \
15-
--hash=sha256:86ed7d9b750603e4ba582ea8edc678657fb4007894a12bcf6f4bb97892f31d20 \
16-
--hash=sha256:98cc583fa0f2f8304968199b01b6b4b94f469a1f4a74c1560506ca2a211378b5 \
17-
# via -r requirements.in
18-
parso==0.7.0 \
19-
--hash=sha256:158c140fc04112dc45bca311633ae5033c2c2a7b732fa33d0955bad8152a8dd0 \
20-
--hash=sha256:908e9fae2144a076d72ae4e25539143d40b8e3eafbaeae03c1bfe226f4cdf12c \
21-
# via jedi
22-
python-jsonrpc-server==0.2.0 \
23-
--hash=sha256:59ce9c9523c14c493a327b3a27ee37464a36dc2b9d8ab485ecbcedd38840380a \
24-
# via -r requirements.in
7+
click==7.1.2 # via jedi-language-server
8+
future==0.18.2 # via python-jsonrpc-server
9+
isort==5.5.2 ; python_version >= "3.6" # via -r requirements.in
10+
git+git://github.com/vscode-python/jedi-language-server@42823a2598d4b6369e9273c5ad237a48c5d67553 # via -r requirements.in
11+
jedi==0.17.2 # via jedi-language-server
12+
parso==0.7.0 # via jedi
13+
pygls==0.9.0 # via jedi-language-server
14+
python-jsonrpc-server==0.2.0 # via -r requirements.in
File renamed without changes.

0 commit comments

Comments
 (0)