Commit Graph

1591 Commits

Author SHA1 Message Date
Eric Traut
de41104883
Merge pull request #511 from microsoft/erictr/clean
Added "clean" command to build script. Fixed bug in build script for …
2020-02-12 12:03:11 -07:00
Eric Traut
c57fafdc5f Fixed ordering of build script — npm install needs to happen before clean because the latter depends on a node module. 2020-02-11 23:23:08 -07:00
Eric Traut
46bb90cca6 Added "clean" command to build script. Fixed bug in build script for debug version of server. 2020-02-11 18:38:00 -07:00
Eric Traut
f3a4aed6ae Revert "Added "clean" build command that deletes artifacts from previous build actions."
This reverts commit e22c661c3e.
2020-02-11 18:23:21 -07:00
Eric Traut
e22c661c3e Added "clean" build command that deletes artifacts from previous build actions. 2020-02-11 17:47:55 -07:00
Eric Traut
a5e3b377f7
Merge pull request #509 from heejaechang/fixRootDirectoryIssue
previously added assert was using wrong path (__dirname rather than _…
2020-02-11 17:19:06 -07:00
HeeJae Chang
bdcd372014 previously added assert was using wrong path (__dirname rather than __dirname/..)
fixed the assert and added comments indicating what is supposed to point what.
2020-02-11 15:31:23 -08:00
Heejae Chang
b1e0ff81dd
made reportMissingTypeStub diagnostics warning by default and some refactoring around code actions. (#507)
* enable generate type stub diagnostic (and hence code action) on by default as "warning"

* refactored code action code a bit
2020-02-11 00:39:21 -08:00
Heejae Chang
9521693b9c
fixed regex issue on linux/mac (#503)
my previous work to make pyright test to pass on windows broke linux and mac scenarios.

this should fix the issues.
2020-02-07 12:17:52 -08:00
Heejae Chang
b9bc57306a
fixed bunch of tslint issue and refactoring on how command handling works (#502)
* fixes many es/tslint style warnings
* Remove map inside map
2020-02-06 12:33:09 -08:00
Mikhail Arkhipov
c08248902e
Merge pull request #501 from heejaechang/fourslashRI
ported typescript fourslash test framework to pyright
2020-02-06 11:32:36 -08:00
HeeJae Chang
59c693b65a ported typescript fourslash test framework to pyright
this PR consists of 3 main changes.

refactoring on pyright, 2. bunch of helper methods in src/common, 3. fourslash related codes in src/test
...

for 1. refactoring.

it has 2 refactorings on pyright and that affects many pyright code. which made file counts of this PR high.

first refactoring is rename of DiagnosticTextPosition and related types to Position/Range and move them out from diagnostics.ts to textRange.ts.

this is done since I needed line column and it is not diagnostic specific concept.

second one is introducing virtual file system to pyright (server/src/common/vfs.ts).

this is needed since I needed pyright to run over virtual file system constructed from fourslash files.
also, after this, nobody in pyright should interact with file system directly (no import * from "fs").

...

for 2. bunch of helper methods in src/common

it is just bunch of helper methods over path, collections, strings and etc fourslash test framework was using. mostly about string, path comparisons, adding/removing collections without caring about corner cases and etc.

...

for 3. fourslash related codes in src/test

all code related to it should be under src/test/harness and actual tests will be in src/test/fourslash

fourslash test framework is consist of 5 components

virtual file system - this is a file system (server/src/tests/harness/vfs/filesystem.ts) emulating real one. it is a standalone lib people can use for other purpose as well. see (server/src/tests/filesystem.test.ts) on how to use it.

fourslash test reader/parser
it reads fourslash file like (server/src/tests/fourslash/dataclass1.fourslash.ts) or (server/src/tests/fourSlashParser.test.ts) and return FourSlashData that contains source + markup information.
this is also a standalone library one can use on other scenarios just for markups.

testState
it maintain current test states. such as what file is opened, where the caret position is, what is current active files, selection is. and hold pyright program, virtual file system and etc. this will be given to a fourslash test file when the test run. and people can interact with it to manipulate or verify test results. see (server/src/tests/testState.test.ts) for what it currently supports. this should keep updated as we add new tests and new test ability.
one thing to remember is that, TestState is what run at runtime (implementation), but for editting, fourslash.ts (declaration) (server/src/tests/fourslash/fourslash.ts) is the one that is used.
that is why there is reference path="fourslash.ts" at the top of each fourslash test file (ex, server/src/tests/fourslash/dataclass1.fourslash.ts). because of that, it is important to put declaration in fourslash.ts if one added new functionality in TestState.

fourslash test runner
this puts everything together and run given fourslash markup strings. to learn how it actually run code. see (server/src/tests/harness/fourslash/runner.ts).
basically, it gets sources (python code) out of fourslash string, and construct virtual file system and connect it to pyright using TestState and then compile the given fourslash markup string since it is actually pure typescript code and then wrapped the compiled javascript code under function and eval the code and run it with TestState as argument. the reference path=".." trick works since it gets ignored within method body as a regular comment.
this is also a standalone lib people can use in other way if wants. see (

server/src/tests/testState.test.ts

test('VerifyDiagnosticsTest1', () => {
) on how to use it.

jest test suite
this connects fourslash test framework to jest. it basically read fourslash test files in **/test/fourslahs/*.fourslash.ts and register it to jest and run them with the fourslash test runner.
(server/src/tests/fourSlashRunner.test.ts)
...

PR also includes some misc changes such as ignoring eslint on fourslash.ts files. or js/ts formatting rule such as putting space after template string since that seems what pyright currently has as a code style. and this also includes some of checker.test.ts converted to fourslahst test to show differences. and debugger launch settings for fourslash tests.

...

how to run fourslash tests.

on command line, if one runs jest tests (ex, npm run test), it will run fourslash tests as well. in vscode, if users choose vscode-jest-tests, it will run fourslash tests as well. if user opens fourslash.ts file and then select fourslash current file in debugger configuration and F5, vscode will run only that fourslash test file.
2020-02-05 13:28:04 -08:00
Mikhail Arkhipov
fc8f190c6c Fix debugging of referenced projects 2020-02-04 23:46:06 -08:00
Eric Traut
634533f207 Changed build script to build server before client, which is needed because of a recent change made by Mikhail. 2020-02-04 22:27:45 -08:00
Eric Traut
d7ded12962 Made small improvements to internals docs. 2020-02-04 13:08:58 -08:00
Mikhail Arkhipov
cfc5c92fe6
Merge pull request #499 from MikhailArkhipov/commands
Unify command identifiers
2020-02-04 12:11:30 -08:00
MikhailArkhipov
d7ed5c1ecd Delete comma 2020-02-04 11:58:04 -08:00
MikhailArkhipov
40c62216be Fix webpack 2020-02-04 11:31:45 -08:00
MikhailArkhipov
88492b956b Unify command identifiers 2020-02-03 15:20:23 -08:00
Eric Traut
6a2904c952
Merge pull request #498 from microsoft/erictr/typings
494: Moved code that sets default typingsPath value so it's executed …
2020-02-01 09:15:57 -08:00
Eric Traut
fb155d608e 494: Moved code that sets default typingsPath value so it's executed regardless of whether there's a config file. 2020-01-31 23:49:35 -08:00
Eric Traut
07288b2e7c Updated configuration title for better consistency with other extensions. 2020-01-31 13:32:03 -08:00
Mikhail Arkhipov
5fa38145a4
Merge pull request #493 from MikhailArkhipov/config
Allow custom configuration settings
2020-01-30 09:53:46 -08:00
MikhailArkhipov
7eefad8016 Formatting and rename config file 2020-01-30 08:57:24 -08:00
Mikhail Arkhipov
0dcec5557e Fix path conversion 2020-01-29 16:00:20 -08:00
Mikhail Arkhipov
8798ccf36e Basic fixes for most tests to pass on Windows 2020-01-29 14:51:03 -08:00
Mikhail Arkhipov
bcdf2e04df Fix parameter 2020-01-29 14:45:23 -08:00
Mikhail Arkhipov
acfcc570b4 Naming consistency 2020-01-29 13:55:18 -08:00
Mikhail Arkhipov
dbbd377981 PR feedback 2020-01-29 13:48:13 -08:00
Mikhail Arkhipov
a2e19d3eed Pass config file name in PyRx 2020-01-24 08:29:33 -08:00
MikhailArkhipov
a750d4428f Add mspython configuration 2020-01-23 15:06:30 -08:00
MikhailArkhipov
874fa27816 Move all extensions into one file 2020-01-23 12:09:24 -08:00
MikhailArkhipov
29579fc541 eslint fix 2020-01-23 12:04:55 -08:00
MikhailArkhipov
7303511006 Style 2020-01-23 11:58:46 -08:00
MikhailArkhipov
b38994a518 PR feedback and add extension methods 2020-01-23 11:43:48 -08:00
Mikhail Arkhipov
3b459027ff Merge branch 'update' into settings 2020-01-21 22:19:18 -08:00
Mikhail Arkhipov
23d3a43731 Style 2020-01-21 21:24:07 -08:00
Mikhail Arkhipov
aa1c6d4199 Add ignoreErrors from Python extension 2020-01-21 21:00:09 -08:00
Mikhail Arkhipov
58fcbe24e3 Style 2020-01-21 18:40:49 -08:00
MikhailArkhipov
75bb5fb253 Initial refactoring 2020-01-21 15:21:38 -08:00
Eric Traut
5c5c58788c Fixed logic that converts function types to a string (for hover text, error messages, etc.). It wasn't correctly handling the 'position-only' argument separator ('/') introduced in Python 3.8. 2020-01-20 19:21:41 -08:00
Eric Traut
e2d2dc6dfe Avoid reporting "partially unknown" error for functions that include "*" parameter. 2020-01-20 18:57:41 -08:00
Eric Traut
dc8d174215 Published 1.1.21 2020-01-20 16:09:35 -08:00
Eric Traut
f9ce8236d0 Added tests for forward-referenced types in non-annotation contexts. 2020-01-18 10:16:40 -08:00
Eric Traut
417ca65dc4 Added support for forward-declared types within contexts other than type annotations. This includes the 'bound' parameter and constraints within a TypeVar declaration, type arguments, the first argument to a "cast" call, and type expressions found within a "NamedTuple". 2020-01-18 09:15:29 -08:00
Eric Traut
61cefc5586 Updated README.md that ships with extension to match the README.md on the github site. 2020-01-16 18:26:26 -08:00
Mikhail Arkhipov
b0872d4cec
Merge pull request #487 from MikhailArkhipov/typeshed
Add parameter to language server base to pass root directory
2020-01-16 16:50:06 -08:00
Mikhail Arkhipov
8702380f37 Formatting 2020-01-16 14:25:50 -08:00
Mikhail Arkhipov
2b06fd1f3a Update readme on how to push to pyright 2020-01-16 14:23:04 -08:00
Mikhail Arkhipov
140a59450b Undo accidental changes 2020-01-16 14:17:47 -08:00