1808 Commits

Author SHA1 Message Date
Andrew Branch
086e00de91
Expand auto-import to all package.json dependencies (#38923)
* Start experiment

* Add logging

* Go back to a single program

* Fix forEachExternalModuleToImportFrom

* Move auxiliary program to language service

* Add logging

* Don’t use resolution cache

* Fix(?) containingProjects for ScriptInfo in auxiliary program

* Fix ScriptInfo project inclusion

* Add test for default project of auto-importable ScriptInfo

* Add fourslash server test

* Don’t create auto import provider inside node_modules

* Add monorepo-like test

* WIP

* Naively ensure autoImportProvider is up to date after package.json change

* Start limiting when auto update provider gets updated

* Respond to changes in node_modules

* Don’t create auto-import provider until a file is open that would use it

e.g., don’t create them during cross-project find-all-refs

* Clean up naming, @internal marking, and fix empty project creation bug

* Drop devDependencies, include peerDependencies

* Add additional compiler options

* Fix interaction with importSuggestionsCache

* Move option to UserPreferences, allow inclusion of devDependencies

* Don’t filter out peerDependencies

* Watch unparseable package.jsons

* But don’t filter packages out due to an invalid package.json

* Update test

* Don’t use autoImportProvider in codefixes where it can never be used (or any refactors)

* Add CompletionEntry property for telemetry

* Add assertion for isPackageJsonImport to fourslash

* Fix missing pushSymbol argument

* Add isPackageJsonImport to tests and API baselines

* Fix unit test

* Host auto import provider in new Project kind

* Fix InferredProject attaching on AutoImportProvider-included files, load eagerly

* Update Public APIs

* Simplify PackageJsonCache host

* Remove unneeded markAsDirty

* Defer project finished event until after AutoImportProvider is created

* Make AutoImportProviderProject always report isOrphan = true

* Close and remove AutoImportProviderProject when host project closes

* Don’t set pendingEnsureProjectForOpenFiles

* Use hasAddedOrRemovedFiles instead of hasNewProgram

* Use host-wide watchOptions for package.json watching

* Add to `printProjects`

* Clean up

* Get autoImportProvider directly from LanguageServiceHost

* Clean up

* Clean up

* Close auto import provider on disableLanguageService

* Move AutoImportProvider preload to project updateGraph

* Clear auto import suggestion cache when provider program changes

* Fix tests

* Revert yet-unneeded change

* Use projectService host for module resolution host

* Don’t re-resolve type directives if nothing has changed

* Update src/server/project.ts

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Use ts.emptyArray

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-06-22 16:34:27 -07:00
Wenlu Wang
59ad375234
Add deprecated related feature (#38523)
* Add deprecated related feature

* Add more support

* fix navtree

* Add identifier check

* Add more deprecated

* fix crash

* fix more crash

* fix crash

* improve diagnostic

* avoid new tag

* avoid tags

* accept baseline

* Check deprecated in binder

* fix baseline

* fix jsdoc cache

* fix incorrect fix

* Avoid useless changes

* Accept baseline

* Add tests

* fix perf

* fix public api

* Adjust deprecated mark on qualifed name

* Revolve alias symbol

* Use modifier flags insted of symbol props

* Fix modifier flag resolve

* Make lint happy

* Fix crash

* fix crash

* Add cached utils function

* Accept baseline

* Add more tests

* try pinning octokit again

* Avoid tests

* Use utils some

* Deprecated perf test (#3)

* check valueDeclaration only

* check without modifierFlags

* donot check alias

* use cached tag

* remove call to jsdoc

* use deprecated tag

* revert changes

* Revert mission changes

* use node flags

* cache result

* cache

* avoid modifier flags

* Opts

* fix jsdoc include modifier

* fix tests

* fix again

* use symbol flag

* set @octokit/rest back to latest

* fix trailing spacel int

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-06-18 17:41:26 -07:00
Ron Buckton
eb3645f16b
Refactor node factory API, use node factory in parser (#35282)
* Refactor node factory API, use node factory in parser

* Move UnparsedSource nodes to factory

* Make most Node properties read-only

* Make pos/end/parent and JSDoc 'comment' read-only

* Update function/constructor-type factories

* Remove treeStateObserver

* Simplify Debug.deprecate

* Remove unused factory methods, simplify lazy factory methods

* Fix base factory used for source file updates

* Update test baseline due to merge from master

* Rename factory methods to be more consistent (#39058)
2020-06-16 16:55:03 -07:00
Sheetal Nandi
0232d4ae8e
Fixes issues with reload because of output emit (#39030)
* If there is no changes to folder structure when watching directories recursively, send the updates to fileNames only
Fixes #37994

* Ignore excluded directories from wild card watching

* Testcase showing that renaming file with non sync directory watcher displays correct error in the end
Testcase for #38684
2020-06-16 16:39:48 -07:00
Sheetal Nandi
25f6232d45
Syntax only server creates inferred project with all the open files w… (#38561)
* Syntax only server creates inferred project with all the open files with noResolve and can handle semantic operations

* No Watching

* Disable tests

* Add and fix tests

* Only support selected commands

* Revert "Disable tests"

This reverts commit 90d8a966ebfae3dd6aeac24686b5cbc723b6e380.

* Dont log request details for unsupported commands
2020-06-16 13:39:20 -07:00
Andrew Branch
852e7a0b60
Add containerName to CallHierarchyItem (#38997)
* Add containerName to CallHierarchyItem

* Update public APIs

* Update test to demonstrate nested namespace working
2020-06-10 11:56:03 -07:00
Sheetal Nandi
a72ed0a2f5
Schedule failed lookup updates (#38560)
* Schedule failed lookup updates

* Tests
2020-06-09 12:00:37 -07:00
Jesse Trinity
3b15b35b37
Merge pull request #38378 from jessetrinity/refactorTriggerReason
Add RefactorTriggerReason
2020-06-03 11:18:08 -07:00
Sheetal Nandi
f0da6d1203
Some changes to tsc baselines for clarity (#38850)
* Baseline programs in tsc -b and tsc -incremental mode as well

* Refactor outFile

* Tests

* Distinct input and output

* Add helper to baseline serialized invocations of tsc on incremental edits

* Input and output in watch mode

* Update src/testRunner/unittests/tsbuild/helpers.ts

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2020-06-02 11:49:21 -07:00
Jesse Trinity
f3751fbdf3 change type of RefactorTriggerReason 2020-05-29 12:54:59 -07:00
Jesse Trinity
23f4dc9bd9 use enum for RefactorTriggerReason 2020-05-29 12:49:41 -07:00
Jesse Trinity
602ee995d0 fix lint errors 2020-05-29 12:45:54 -07:00
Jesse Trinity
bac046573f add trigger reason to protocol 2020-05-29 12:41:06 -07:00
Sheetal Nandi
5d6a5d04ea
Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) (#38429)
Fixes #38366
2020-05-12 10:16:59 -07:00
Manuel Thalmann
cbc959ba35
Make isDynamicFileName available publicly (#38269)
* Make isDynamicFileName available publicly

This commit fixes #37987

* Acknowledge Public APIs
2020-05-08 07:31:59 -07:00
Nathan Shively-Sanders
d571a09cf8
Navto covers all projects (#38027)
* Remove needless structure/destructuring

Just pass multiple arguments! Sheesh!

* Basic working prototype

* Cleaned up version

1. Add test
2. Change protocol. navto-all only happens when filename is undefined or
missing.
3. Change location to earlier code path. This change was largely
type-guided and resulted in some duplicated code, but I think it's less
fault-prone.

* remove temp notes

* Single-project hits if projectFileName is provided

and file is not

* use original code as fallback
2020-04-21 15:20:36 -07:00
Sheetal Nandi
0ae938b718
Report error when cannot read file (#37611)
This also consolidates helper for readFile failure
2020-03-25 21:29:02 -07:00
Sheetal Nandi
b7b2c333a9
Handle if reading tsconfig file fails (#37563)
Fixes #36862
2020-03-25 10:14:31 -07:00
Sheetal Nandi
9f296ce96d
Do not include global errors in semantic errors from the file (#37545)
Fixes #37084
2020-03-24 09:53:27 -07:00
Sheetal Nandi
8f64d667f2
If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape (#37483)
* Add test that calling getAffectedFiles on two different files (even if the second one is saved) returns all files

* If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape
Fixes #30508
2020-03-20 10:16:41 -07:00
Sheetal Nandi
7e07a2b5d1
Allow rich response for compile on save (#37462)
Fixes #30739
2020-03-19 14:03:21 -07:00
Sheetal Nandi
2df421b067
Always generate configFileDiag if file is going to be added to configured project (#37443)
Fixes #30623
2020-03-18 10:39:25 -07:00
Jesse Trinity
4c160683c3
Add trimTrailingWhitespace Editor Option (#36905)
* add trim trailing whitespace option

* set default trimTrailingWhiteSpace to true

* add fourslash tests

* accept new baselines

* only preserce whitespace when setting is explicitly false

* format whitespace
2020-03-13 13:42:49 -07:00
Sheetal Nandi
ba39113ab9
Handle when default project for file is solution with file actually referenced by one of the project references (#37239)
* Add test where file from referenced project of solution belongs to inferred project instead of referenced project

* Try to find project from project references if the default config project is solution
Fixes #36708

* Add test to verify the correct collection of projects

* Handle when default config project is indirectly referenced in the solution

* Include public API tests in unittests

* Make sure default project for script info is calculated correctly

* Handle reload projects

* Ensure to load solution project tree when project is referenced by solution

* Find all refs when the file is referenced via d.ts

* Some comments per feedback

* Fix typo
2020-03-13 10:46:58 -07:00
Sheetal Nandi
a76a16696d
Move useSourceOfProjectReferenceRedirect to program so other hosts can use it too, enabling it for WatchHost (#37370) 2020-03-12 13:11:11 -07:00
Sheetal Nandi
243186685b
Increase the idle time before which ensureProject for open file is called (#37121)
* Increase timeout for ensuring projects for open files

* Condense the project/file printing in the log (given now we have project printed anytime its structure changes)
2020-03-11 16:47:11 -07:00
Andrew Casey
dd6811fbe3
Stop looking for the default configured project at node_modules (#35011)
* Optionally stop looking for the default configured project at
node_modules

* Make stopping at node_modules non-optional

* Generalize and simplify the change - node_modules files don't have default configured projects
2020-03-02 16:52:03 -08:00
Sheetal Nandi
05c9ec3f12
Remove unnecessary assert (since we allow already open file to be opened again even through openFile command - partially) from updateOpen command (#37059)
Fixes #35034
2020-02-26 15:25:51 -08:00
Sheetal Nandi
e89df5ce6f
Handle getScriptVersion correctly to ensure program structure is checked correctly (#36808)
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect

* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes #36748

* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands

* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge

* Update src/server/project.ts

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Make clearSourceMapperCache required

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 16:11:21 -08:00
Ryan Cavanaugh
c22cdb446a
Harden telemetryOnOpenFile (#36993) 2020-02-25 11:32:32 -08:00
Ron Buckton
177713ef45
Switch Debug.assertX functions to use asserts conditions (#36995)
* Switch Debug.assertX functions to use asserts conditions

* Replace assert functions with ts.noop when assertion level too low
2020-02-24 18:20:58 -08:00
Andrew Casey
cf24c4fdc0
Fix copy-paste error in navigateToItemIsEqualTo (#36912)
* Fix copy-paste error in navigateToItemIsEqualTo

It was preventing de-duping of items found in multiple projects.

* Add de-duping test
2020-02-20 17:30:50 -08:00
Andrew Branch
4d1a1b850a
Expose importModuleSpecifierEnding to protocol (#36725)
* Expose importModuleSpecifierEnding to protocol

* Update API baselines

* Add explicit auto setting
2020-02-20 13:59:56 -08:00
Nathan Shively-Sanders
d76380419d
Fix typo in getChangesSinceVersion (#36885) 2020-02-20 08:30:22 -08:00
Sheetal Nandi
70e6f5b8a0
Handle walkThroughSnippet:/ and untitled:/ as dynamic files (#36722)
Handle walkThroughSnippet:/ and untitled:/ as dynamic files
Fixes #36681
2020-02-10 13:55:43 -08:00
Andrew Casey
2e97918d43
Make Response.performanceData public (#36595) 2020-02-04 15:07:48 -08:00
Ron Buckton
9a357c19f3
Fix wrong script info used to resolve line/offset for call hierarchy items (#36559) 2020-01-31 14:41:25 -08:00
Sheetal Nandi
80ad0de87e
Fixes to handle file names in module resolution watching and createGetCanonicalFileName (#36106)
* Add test case to verify directory casing preservation when watching

* Fix unicode file name handling when watching failed lookup locations

* Add special file name lower conversion routine and use that instead of toLowerCase
Fixes #31819 and #35559

* Remove unicode from code

* Replace toLocaleLowerCase on filenames with ts.toFileNameLowerCase

* Make the intent of using toFileNameLowerCase more clear and why we make the restriction on turkish I with dot on top of it

* Update baselines for newly added tests in master
2020-01-31 10:40:57 -08:00
Hye Sung Jung
8ed129771f
fix spelling errors (#36523)
* fix spelling errors

* remove changes in lib/*
2020-01-30 13:39:54 -08:00
Andrew Casey
566202f55d
Fix commas in JSON (#36497) 2020-01-29 10:50:03 -08:00
Ben Lichtman
e87b2e3506
Merge pull request #36063 from uniqueiniquity/addWeakCompletionProperty
Add completion property to identify completions from unchecked files
2020-01-28 13:53:47 -08:00
Ben Lichtman
fdf29891e2
Merge pull request #36383 from uniqueiniquity/redirectInfo
Redirect info
2020-01-28 11:51:06 -08:00
Sheetal Nandi
a87512d21b
Add # to completion trigger character, (#36462)
Handle private identifiers little better by creating token for private identifier when its just #
Report same error as invalid character but from language service we can now provide completions for this.#

Fixes #36367, #36250
2020-01-27 14:25:20 -08:00
Ben Lichtman
e479a9f679 Respond to CR 2020-01-24 16:23:54 -08:00
Sheetal Nandi
096e1b12e4
Handle error reporting of files when new file is created after its opened in editor (#36271)
* If script info is not attached to the project on which wild card is invoked, update it.

* Instead of getting default project before starting error list timer, get it at that time if no project is specified
Fixes #35794

* Fix the open File watch triggered setting
2020-01-24 16:07:48 -08:00
Ben Lichtman
f047111c64 Track changes to redirect info 2020-01-24 15:15:05 -08:00
Ben Lichtman
703685318c Merge branch 'master' into redirectInfo 2020-01-23 14:12:01 -08:00
Ben Lichtman
c9c3792747 Produce redirect info about files when requested 2020-01-23 12:32:36 -08:00
Sheetal Nandi
b2a7d42032
Handle untitled files from vscode which are of format: untitled:^Untitled-1 (#36240)
* Test for #36200

* Handle dynamic files by vscode
Fixes #36200
2020-01-16 15:38:55 -08:00
Andrew Casey
f99072593d
Move individual duration properties into a performanceData object (#36210) 2020-01-15 16:48:00 -08:00