Skip to content

Commit 962c850

Browse files
author
Mikhail Arkhipov
authored
VS Python analysis engine integration (#1231)
* Undo changes * Test fixes * Increase timeout * Remove double event listening * Remove test * Revert "Remove test" This reverts commit e240c3f. * Revert "Remove double event listening" This reverts commit af573be. * Undo changes * Test fixes * .NET Core check * Better find dotnet * Fix pip test * Linting tests * Undo accidental changes * Add clone and build PTVS * Appveyor PTVS build * Fix slashes * Enable build * Try absolute path * Fix xcopy switch * Activate Analysis Engine test on Appveyor * Temporary only run new tests * Disable PEP hint tests * Test fix * Disable appveyor build and tests for PTVS for now * Remove analysis engine test from the set * Remove VS image for now * Build/sign VSXI project * Run vsce from cmd * Rename * Abs path vsce * Path * Move project * Ignore publishing project * Try csproj * Add framework * Ignore build output folder * Package before build * Try batch instead of PS * Fix path quotes * #1096 The if statement is automatically formatted incorrectly * Merge fix * Add more tests * More tests * Typo * Test * Also better handle multiline arguments * Changes lost on squash * More lost changes * Restore Jedi/PTVS setting * Update tests to new PTVS * Signature tests * Add PTVS tests task * Analysis Engine contribution * Add Mac/Linux info * Disable csproj build * Add unzip to dependencies * Minor fixes to doc * Change setting type to bool * Report progress on status bar * Simplify * CR feedback * Fix launching fx-independent code on Mac/Linux * Add title
1 parent 90b4e1e commit 962c850

38 files changed

+2376
-1207
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ coverage/
1616
pythonFiles/experimental/ptvsd/**
1717
debug_coverage*/**
1818
analysis/**
19+
bin/**
20+
obj/**

.vscode/launch.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,26 @@
8787
],
8888
"preLaunchTask": "Compile"
8989
},
90+
{
91+
"name": "Launch Analysis Engine Tests",
92+
"type": "extensionHost",
93+
"request": "launch",
94+
"runtimeExecutable": "${execPath}",
95+
"args": [
96+
"${workspaceFolder}/src/test",
97+
"--extensionDevelopmentPath=${workspaceFolder}",
98+
"--extensionTestsPath=${workspaceFolder}/out/test"
99+
],
100+
"stopOnEntry": false,
101+
"sourceMaps": true,
102+
"outFiles": [
103+
"${workspaceFolder}/out/**/*.js"
104+
],
105+
"preLaunchTask": "Compile",
106+
"env": {
107+
"VSC_PYTHON_ANALYSIS": "1"
108+
}
109+
},
90110
{
91111
"name": "Launch Tests (with code coverage)",
92112
"type": "extensionHost",
@@ -114,4 +134,4 @@
114134
]
115135
}
116136
]
117-
}
137+
}

.vscodeignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ CODING_STANDARDS.md
3737
CONTRIBUTING.md
3838
news/**
3939
debug_coverage*/**
40+
analysis/publish*.*
41+
vscode-python-signing.*
42+
packageExtension.cmd
43+
bin/**
44+
obj/**
45+
BuildOutput/**
46+
47+

CONTRIBUTING - PYTHON_ANALYSIS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributing to Microsoft Python Analysis Engine
2+
[![Contributing to Python Tools for Visual Studio](https://github.com/Microsoft/PTVS/blob/master/CONTRIBUTING.md)]
3+
4+
[![Build Status (Travis)](https://travis-ci.org/Microsoft/vscode-python.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-python) [![Build status (AppVeyor)](https://ci.appveyor.com/api/projects/status/s0pt8d79gqw222j7?svg=true)](https://ci.appveyor.com/project/DonJayamanne/vscode-python-v3vd6) [![codecov](https://codecov.io/gh/Microsoft/vscode-python/branch/master/graph/badge.svg)](https://codecov.io/gh/Microsoft/vscode-python)
5+
6+
7+
## Contributing a pull request
8+
9+
### Prerequisites
10+
11+
1. .NET Core 2.0+ SDK
12+
- [Windows](https://www.microsoft.com/net/learn/get-started/windows)
13+
- [Mac OS](https://www.microsoft.com/net/learn/get-started/macos)
14+
- [Linux](https://www.microsoft.com/net/learn/get-started/linux/rhel)
15+
2. C# Extension to VS Code (all platforms)
16+
3. Python 2.7
17+
4. Python 3.6
18+
19+
*Alternative:* [Visual Studio 2017](https://www.visualstudio.com/downloads/) (Windows only) with .NET Core and C# Workloads. Community Edition is free and is fully functional.
20+
21+
### Setup
22+
23+
```shell
24+
git clone https://github.com/microsoft/ptvs
25+
cd Python/Product/VsCode/AnalysisVsc
26+
dotnet build
27+
```
28+
29+
Visual Studio 2017:
30+
1. Open solution in Python/Product/VsCode
31+
2. Build AnalysisVsc project
32+
3. Binaries arrive in *Python/BuildOutput/VsCode/raw*
33+
4. Delete contents of the *analysis* folder in the Python Extension folder
34+
5. Copy *.dll, *.pdb, *.json fron *Python/BuildOutput/VsCode/raw* to *analysis*
35+
36+
### Debugging code in Python Extension to VS Code
37+
Folow regular TypeScript debugging steps
38+
39+
### Debugging C# code in Python Analysis Engine
40+
1. Launch another instance of VS Code
41+
2. Open Python/Product/VsCode/AnalysisVsc folder
42+
3. Python Analysis Engine code is in *Python/Product/VsCode/Analysis*
43+
4. Run extension from VS Code
44+
5. In the instance with C# code select Dotnet Attach launch task.
45+
6. Attach to *dotnet* process running *Microsoft.PythonTools.VsCode.dll*
46+
47+
On Windows you can also attach from Visual Studio 2017.
48+
49+
### Validate your changes
50+
51+
1. Build C# code
52+
2. Copy binaries to *analysis* folder
53+
3. Use the `Launch Extension` launch option.
54+
55+
### Unit Tests
56+
1. Run the Unit Tests via the `Launch Analysis Engine Tests`.
57+
2. On Windows you can also open complete PTVS solution in Visual Studio and run its tests (or at least the Analysis section).
58+
59+
60+
### Coding Standards
61+
See [![Contributing to Python Tools for Visual Studio](https://github.com/Microsoft/PTVS/blob/master/CONTRIBUTING.md)]

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
[![Build Status (Travis)](https://travis-ci.org/Microsoft/vscode-python.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-python) [![Build status (AppVeyor)](https://ci.appveyor.com/api/projects/status/s0pt8d79gqw222j7?svg=true)](https://ci.appveyor.com/project/DonJayamanne/vscode-python-v3vd6) [![codecov](https://codecov.io/gh/Microsoft/vscode-python/branch/master/graph/badge.svg)](https://codecov.io/gh/Microsoft/vscode-python)
44

5-
5+
# Contributing to Microsoft Python Analysis Engine
6+
[![Contributing to Python Analysis Engine](https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING - PYTHON_ANALYSIS.md)]
67

78
## Contributing a pull request
89

appveyor.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#image: Visual Studio 2017
2+
#shallow_clone: true
3+
14
environment:
25
matrix:
36
- PYTHON: "C:\\Python36"
@@ -20,11 +23,23 @@ install:
2023
- python -m easy_install -U setuptools
2124
- "%PYTHON%/Scripts/pip.exe install --upgrade -r requirements.txt"
2225

26+
build: off
27+
# build_script:
28+
# - git clone https://github.com/MikhailArkhipov/PTVS.git c:/projects/PTVS
29+
# - "cd c:\\projects\\PTVS"
30+
# - git checkout origin/vsc
31+
# - "cd Python\\Product\\VSCode\\AnalysisVsc"
32+
# - "dotnet --info"
33+
# - "dotnet build"
34+
# - "cd c:\\projects\\vscode-python"
35+
# - "xcopy /S /I c:\\projects\\PTVS\\BuildOutput\\VsCode\\raw analysis"
36+
2337
test_script:
2438
- yarn run clean
2539
- yarn run vscode:prepublish
2640
- yarn run testDebugger --silent
2741
- yarn run testSingleWorkspace --silent
2842
- yarn run testMultiWorkspace --silent
43+
# - yarn run testAnalysisEngine --silent
44+
2945

30-
build: off

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,12 @@
10521052
"default": "${workspaceFolder}/.env",
10531053
"scope": "resource"
10541054
},
1055+
"python.jediEnabled": {
1056+
"type": "boolean",
1057+
"default": true,
1058+
"description": "Enables Jedi as IntelliSense engine instead of Microsoft Python Analysis Engine.",
1059+
"scope": "resource"
1060+
},
10551061
"python.jediPath": {
10561062
"type": "string",
10571063
"default": "",
@@ -1727,6 +1733,7 @@
17271733
"testDebugger": "node ./out/test/debuggerTest.js",
17281734
"testSingleWorkspace": "node ./out/test/standardTest.js",
17291735
"testMultiWorkspace": "node ./out/test/multiRootTest.js",
1736+
"testAnalysisEngine": "node ./out/test/analysisEngineTest.js",
17301737
"precommit": "node gulpfile.js",
17311738
"lint-staged": "node gulpfile.js",
17321739
"lint": "tslint src/**/*.ts -t verbose",
@@ -1750,6 +1757,7 @@
17501757
"opn": "^5.1.0",
17511758
"pidusage": "^1.2.0",
17521759
"reflect-metadata": "^0.1.12",
1760+
"request-progress": "^3.0.0",
17531761
"rxjs": "^5.5.2",
17541762
"semver": "^5.4.1",
17551763
"sudo-prompt": "^8.0.0",
@@ -1759,6 +1767,7 @@
17591767
"uint64be": "^1.0.1",
17601768
"unicode": "^10.0.0",
17611769
"untildify": "^3.0.2",
1770+
"unzip": "^0.1.11",
17621771
"vscode-debugadapter": "^1.0.1",
17631772
"vscode-debugprotocol": "^1.0.1",
17641773
"vscode-extension-telemetry": "^0.0.14",

packageExtension.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%1\vsce package --out %2

0 commit comments

Comments
 (0)