6330 Commits

Author SHA1 Message Date
Jake Bailey
b56483feb8
Remove shims project (#50049) 2022-08-10 11:49:59 -07:00
Oleksandr T
f70cb769ef
feat(49928): Provide quick fix for a missing callback function (#49930)
* feat(49928): provide quick fix for a missing callback function

* remove addFunctionDeclarationFromSignature. fix formatting

* add tests
2022-08-09 15:28:03 -07:00
Oleksandr T
a44354af7c
fix(50188): omit QF on function arguments (#50189) 2022-08-04 17:52:09 -07:00
Oleksandr T
59c91f6ce9
fix(50077): skip convertOverloadListToSingleSignature refactoring if position is in function body (#50093) 2022-08-03 13:56:42 -07:00
Sheetal Nandi
394f51aeed
Fix implied formats, file watching, new source file creating during edits (#50098)
* Add test where module resolution cache is not local and hence doesnt report errors in watch mode

* Ensure module resolution cache is passed through in watch mode

* Remove unnecessary setting of impliedFormat which should anyways be done as part of create source file

* Add test for packge.json changing and modifying implied format

* Distinguish between package.json watch and affecting file location watch

* Pass in failed lookup and affected file locations for source file's implied format
Also stop creating options if we already have them

* Add diagnostic for explaining file's implied format if based on package.json

* Watch implied format dependencies for modules and schedule update on change

* For program if implied node format doesnt match create new source file. Handle implied node format in document registry
Fixes #50086

* Modify tests to show package.json being watched irrespective of folder its in

* Check file path if it can be watched before watching package.json file

* Because we are watching package.json files and failed lookups its safe to invalidate package json entries instead of clearing them out everytime program is created

* Remove todos

* Fix the incorrect merge

* Pickup PackageJsonInfo renames from #50088

* Rename
2022-08-01 12:41:37 -07:00
Andrew Branch
b7355e30af
Fix trailing formatting edit when range ends mid-token (#50082) 2022-07-28 12:11:22 -07:00
Oleksandr T
94bb950008
feat(49358): use filename based on exported name (#49875) 2022-07-27 15:41:31 -07:00
Josh Goldberg
ebd42abf95
Account for type parameters in missing function codefix (#49727)
* Account for type parameters in missing function codefix

* Apply suggestions from code review

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

* WIP

* Synthesize new type parameters instead of deep unions and intersections

* Pass along type parameter constraints

* E.T. phone home

* Clean up comments just a bit

* Only widen the instance type sometimes

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-07-26 15:22:19 -07:00
Oleksandr T
bcd22b47d2
fix(50048): remove token name from id (#50051) 2022-07-26 01:13:04 -07:00
Jake Bailey
966e732ed4
Remove uses of visitNodes and visitNode in visitEachChild (#49992) 2022-07-22 19:35:39 -07:00
Oleksandr T
455ea9b41f
fix(49964): handle auto-import dependencies/omit duplicate constraints (#50004) 2022-07-22 11:01:43 -07:00
Armando Aguirre
7b764164ed
Fixed closing JSDoc when adding multiple blocks (#49888)
* Fixed closing JSDoc when adding multiple blocks

* Fixed linting errors

* Refactored to use `some`

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

* Removed empty lines

Co-authored-by: Armando Aguirre <araguir@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-07-21 13:16:40 -07:00
Andrew Casey
8402d657ab
Document order-dependence of isLocal flag (#49959) 2022-07-19 14:38:35 -07:00
Oleksandr T
5a53e9bb5e
fix(49838): "Extract function" refactoring action is disabled for a wrong reason (#49840)
* fix(49838): allow extracting functions with a break statement inside loop context

* remove useless flag

* add more tests
2022-07-19 13:06:45 -07:00
Oleksandr T
3863cc4a20
feat(49786): show completions in expression with type arguments (#49810) 2022-07-18 14:55:15 -07:00
Oleksandr T
91f7cfc501
fix(49392): show optional class methods with enabled strict option (#49768) 2022-07-18 14:49:13 -07:00
Babak K. Shandiz
8e6e87fea6
🐛 Fix smart selection of propery signatures having JSDoc comments (#49804)
* 🐛 Avoid grouping JSDoc nodes of propery signatures with others in smart selection

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* ⚗️ Add test case for JSDoc smart selection (#39618)

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* ⚗️ Add test baseline for JSDoc smart selection (#39618)

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* 🐛 Fix skipping SyntaxList first child's JSDoc in smart selection

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Add tests to ensure not skipping first SyntaxList child's JSDoc

Signed-off-by: GitHub <noreply@github.com>

* 🔨 Exclude JSDoc token from tokens pivoting property signature

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Update test case to also include modifier

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Update test case reference baseline

Signed-off-by: GitHub <noreply@github.com>
2022-07-12 09:04:21 -07:00
Andrew Branch
9dde56c6fc
Add path completions for package.json exports with wildcards (#49644)
* Support path completions for exports wildcards

* Break up results by directory

* Share code between typesVersions and exports processing

* Revert completion kind change

* Add kinds to tests

* Update existing test

* Support nested conditions, improve recursive globbing
2022-07-07 12:26:18 -07:00
Oleksandr T
7584e6aad6
fix(49642): resolve JsDoc comments/tags if accessors exist in symbol declarations (#49654) 2022-07-06 15:41:50 -07:00
Andrew Branch
8002369871
Protect against a language service host mutating its underlying source for getScriptFileNames (#49813)
* Protect against a language service host mutating its underlying source for `getScriptFileNames`

* Add comment
2022-07-06 10:49:01 -07:00
Oleksandr T
cdc1996e87
fix(49426): Object method snippet completions incorrectly add this parameters (#49757)
* fix(49426): omit this parameter

* add OmitThisParameter to TypeFormatFlags

* change flag value
2022-07-05 11:46:19 -07:00
Wesley Wigham
52f4055174
For missing constraint quickfix insert position, Use node name end rather than related span end (#49673) 2022-06-29 11:46:42 -07:00
Nathan Shively-Sanders
cba184f69b
Demote priority of JS completions (#49716)
* Demote priority of JS completions

Fixes #48498

Unchecked JS files gather identifier-based completions. Currently, this search
happens instead of `getCompletionEntriesFromSymbols` for TS/checked JS
files. However, identifier-based completions are much lower quality and
can be ignored by some editors.

Identifier-based completions should be gathered last, after gathering
other completions. That's what this PR does.

* Invert isUncheckedFile to avoid double negative

* dedupe calls to getCompletionEntriesFromSymbols

* Stop re-creating list of entry names

* more deduping + fix lint
2022-06-29 11:05:50 -07:00
Andrew Casey
8ed846c73b
Reuse start position in binarySearchKey (#49641)
* Reuse start position in binarySearchKey

* Kick out early if end < position
2022-06-27 14:31:22 -07:00
Andrew Casey
020ef41543
Add a simple queue implementation with better performance than Array.shift (#49623)
* Add a simple queue implementation with better performance than `Array.shift`

This lets us clean up the hack introduced in #49581

* Correct typo

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2022-06-24 10:07:28 -07:00
bentongxyz
b24b6a1125
fixes #49491 (#49493) 2022-06-22 13:25:01 -07:00
Oleksandr T
74d76e93b3
fix(49546): create computed property name for symbol props (#49554) 2022-06-20 13:46:47 -07:00
Oleksandr T
c01afb5ef3
fix(49548): show completions after keywords in block (#49600) 2022-06-20 12:52:28 -07:00
Andrew Branch
7e7c53961a
Add TS Server option to exclude files from auto-imports (#49578)
* Basic functionality

* Add tests

* Add test for ambient modules

* Add to protocol
2022-06-17 14:39:51 -07:00
Gabriela Araujo Britto
86d5040031
Fix renaming of node_modules (#49568)
* add bug repro test

* add test and start fix implementation

* adjust for useAlias preference

* fix existing renaming test

* refactor to get rid of options

* fix named bindings & other imports cases

* fix eslint error

* address cr comments

* hopefully actually fix eslint

* clean up stale baseline

* make API change non-breaking

* add/fix comments
2022-06-16 17:01:44 -07:00
Oleksandr T
f83ce9bd9c
fix(49566): Implicit this.property completions not returned while writing property (#49574)
* fix(49566): show this.prop completions in class scoped property declaration

* remove duplicate default value
2022-06-16 12:43:50 -07:00
Oleksandr T
180bc4cbea
feat(49385): forbid inlay hints for some kind of initialized declarations (#49412)
.
2022-06-15 15:34:57 -07:00
Wesley Wigham
ba38fe1df2
Expand constraint suggestion related span and add quick fix (#49481)
* Expand constraint suggestion related span and add quick fix

* Remove circular constraint suggestions

* Add error code

* Style feedback and new error code in quickfix
2022-06-15 10:35:51 -07:00
Oleksandr T
806a710470
fix(49478): add return type to method signature (#49482) 2022-06-10 14:14:36 -07:00
Ron Buckton
1e65b330a7
Merge 'decorators' into 'modifiers' on various nodes (#49089)
* Merge 'decorators' into 'modifiers' on various Nodes

* Drop RESERVED argument in favor of removing parameter

* Ignore grammar error nodes when asserting invariants

* Revert 'illegalX' property renames

* PR Feedback
2022-06-09 17:24:02 -07:00
Andrew Branch
00c7c476dc
Avoid repeating codefix work when resolving auto-import specifiers for completions (#49442) 2022-06-09 10:37:16 -07:00
Sheetal Nandi
5cedf3e680
Handle package.json watch in tsc and tsserver. (#49328)
* refactoring

* Maintain packagejson paths per resolution so we dont have invalidate everything on package json change

* Fix todo
2022-06-08 10:22:29 -07:00
Jake Bailey
f72b1badff
Replace ts.hasOwnProperty.call(...) with hasProperty(...) (#49410) 2022-06-06 20:10:40 -07:00
Oleksandr T
2f13eba42c
fix(47821): skip nodes with export modifiers (#47829) 2022-06-06 10:49:55 -07:00
Andrew Branch
f483ab5c2f
Explicit types should prevent ATA from doing package.json discovery (#49380) 2022-06-03 15:21:21 -07:00
TRCYX
44b9745942
fix(49151): format type parameters/arguments (#49165)
Before, the formatter did not consider these constructs as comma
separated lists in general, leading to wrong indentation of '>' after
the list.
2022-05-31 16:03:17 -07:00
Oleksandr T
3da165e3df
fix(49178): check expression with type arguments in inlay hints (#49179) 2022-05-31 15:22:16 -07:00
TRCYX
38631e6412
fix(30003): formatter deletes comment after trailing comma (#49168)
Co-authored-by: TRCYX <trcyxs@gmail.com>
2022-05-27 10:09:52 -07:00
Andrew Branch
5b86612f68
Fix crash from inaccurate type guard implementation (#49252)
* Fix `isVariableDeclarationInitializedToBareOrAccessedRequire` returning true on binding elements

* Undo auto format change
2022-05-26 16:43:22 -07:00
Huy
1fb2b2d70f
fix(47562): Add option to suppress type hint if variable name matches type name (#48529)
* fix(47562): Add option to suppress type hint if variable name matches type

* Remove the unnecessary debug code

* Re-run gulp runtests

* Use equateStringsCaseInsensitive to compare strings
2022-05-25 12:07:38 -07:00
Oleksandr T
b57d6e1df4
fix(49131): allow type keyword inside functions (#49134) 2022-05-24 15:16:48 -07:00
Andrew Branch
0921eac6dc
Fix path completions for typesVersions (#49154)
* Fix path completions for typesVersions

* Add more tests

* Fix case when * is a fragment of a path component

* Once a path pattern matches, only return completions from that pattern and higher priority ones

* Fix iteration order issue

* Aesthetics
2022-05-19 14:33:46 -07:00
Andrew Casey
5aa0053c74
Use changeCompilerHostLikeToUseCache in synchronizeHostData (#48980)
* Remove unnecessary members of HostCache

* Standardize on calling compiler host members in preparation for adding caching at that layer

* Call changeCompilerHostLikeToUseCache to cache existence checks

* Drop now-redundant HostCache

* Don't make directoryExists caching contingent on createDirectory

* Clear compilerHost rather than tracking state
2022-05-18 17:26:55 -07:00
Andrew Casey
12ed01203c
Clean up FAR aggregation (#48619)
* Clean up FAR and RenameLocations

This change had two goals:

1. Make the code easier to understand, primarily by simplifying the callback structure and minimizing side-effects
2. Improve performance by reducing repeated work, both FAR searches of individual projects and default tsconfig searches

This implementation attempts to preserve the merging order found in the original code (someone less relevant in the present state of using syntactic isDefinition).

* Stop enforcing search and aggregation order

...in preparation for implementing isDefinition explicitly.

Also restore convention of referring to `DocumentPosition`s as "locations".

* Introduce LanguageService.updateIsDefinitionOfReferencedSymbols

...to allow use of the checker when computing isDefinition across projects.

* Update baselines

* Tidy diff

* De-dup simplified results

* Baseline cross-project isDefinition results

* Move de-duping upstream to fix Full output

* Add server baseline test to confirm searches are not repeated

* Manually merge #48758

* Update baseline for newer fix to #48963
2022-05-18 17:26:17 -07:00
Oleksandr T
0df9462a96
fix(49058): Language service crashes for static member in class with unresolved base members (#49059)
* fix(49058): skip unresolved base members

* use getTypeOfSymbol instead of getExportsOfModule
2022-05-16 14:29:40 -07:00