Commit Graph

4252 Commits

Author SHA1 Message Date
Zzzen
f4b99ea47c preserve this when extracting functions (#41992)
* preserve this when extracting functions

* rename IsThisReferringToFunction to UsesThisInFunction

* refactor

* update tests
2022-04-07 15:05:46 -07:00
Andrew Casey
76e74370ab Only report isDefinition when FAR is triggered on a definition (#48566)
* Don't report isDefinition unless the starting node is a declaration

* Drop isDefinition everywhere it isn't specifically needed

* Fix tsserver tests

* Update shim comment

* Update baselines

* Add tests for isDefinition

* Update doc comment

* Clear isDefinition from all references if the first one lacks it
2022-04-05 17:04:18 -07:00
Oleksandr T
9881c993fc fix(48544): allow to convert default exports to names for import type nodes (#48550) 2022-04-05 16:53:01 -07:00
Minh Quy
50a5bc839a fix(48540): Extract to typedef from (invalid) type with comments in JS file causes assertion failure (#48545)
* fix(48540): Remove comments from jsdoc union type expression

* fix(48540) - Remove comment for top level import and add extract typedef tests

* fix(48540) - Remove comments from jsdoc's descendant

* fix(48540) - Using no nested comments instead of traversing
2022-04-05 16:51:32 -07:00
Ron Buckton
7da80d79e2 Add 'extends' clause to 'infer' type (#48112)
* Add 'extends' clause to 'infer' type

* Revise parse for infer..extends, improve parenthesizer

* More aggressive parens to match existing DT tests

* tests 'infer' constraint using outer type parameter

* Adds a test showing 'infer' cannot reference other 'infer' in same 'extends'

* Emit extends clause for synthetic infer typesduring declaration emit
2022-04-05 12:35:28 -07:00
Minh Quy
6e0447fdf1 [Feature] - Automatically create sort groups based on newlines (#48330)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-04-05 11:53:19 -07:00
Minh Quy
25aecd4c3e fix(48109) - 'Convert to arrow function' refactoring adds extra indent (#48440)
* fix(48109) - Remove extra indent when converting to arrow function

* fix(48109) - Only treat curly brace in object literal as block

* Apply suggestions from code review

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2022-04-04 17:57:34 -07:00
Andrew Casey
493ddc2447 Remove non-baselining fourslash FAR validation (#48564)
* Fix fourslash failures

* Delete unused FAR fourslash helpers
2022-04-04 16:54:10 -07:00
Oleksandr T
aa3c5a787c fix(48418): allow using empty tuple (#48420) 2022-04-04 14:56:35 -07:00
Oleksandr T
e5ca3e4386 fix(48406): resolve JSDoc host of property signature (#48407) 2022-04-04 14:42:50 -07:00
Oleksandr T
7465f04666 fix(48542): omit parameter info of contextual union type (#48549) 2022-04-04 14:05:20 -07:00
Oleksandr T
e02998f70d fix(48541): forbid function extraction to arrow function with expression body (#48548) 2022-04-04 12:27:49 -07:00
Andrew Casey
d5f5c6d61e Convert many tests from verify.singleReferenceGroup to verify.baselineFindAllReferences (#48518)
* Convert referenceToClass to baselining

* Delete stray marker from findAllRefsInsideWithBlock

* Bulk convert tests that just call verify.singleReferenceGroup

* Update tests with duplicate names

* Bulk update verify.singleReferenceGroup tests with BOMs

* Semi-automatically convert FAR tests with explicit range code

* Convert findAllReferencesDynamicImport2 to baselines
2022-04-04 09:23:58 -07:00
Oleksandr T
2db17fdda2 fix(48520): fix getting parameter type by index (#48521) 2022-04-03 21:42:37 -07:00
Andrew Casey
337d1326fb Sync fourslash shims and shims-pp (#48507)
It appears that they were intended to be identical so, in each case, I updated the side that looked less correct.
2022-04-01 11:14:14 -07:00
Andrew Casey
8020072281 Respect @BaselineFile in fourslash tests and tidy up quickInfoDisplayPartsVarShims (#48506) 2022-04-01 09:24:14 -07:00
Oleksandr T
9cfa6e25af fix(48405): emit dummy members from a mapped type (#48481) 2022-03-31 10:15:12 -07:00
Oleksandr T
e62f960648 fix(47733): omit JSDoc comment template suggestion on node with existing JSDoc (#47748) 2022-03-30 15:36:47 -07:00
Jake Bailey
3c6c2799b6 Ensure that we copy empty NodeArrays during transform (#48490) 2022-03-30 15:33:51 -07:00
Oleksandr T
c639d3afb9 feat(27615): Add missing member fix should work for type literals (#47212) 2022-03-30 12:55:18 -07:00
Gabriela Araujo Britto
f57bdaa097 Add label details to completion entry (#48429)
* add label details to completion entry

* Use label details for obj literal method completions

* add label details support flag

* add label details support to fourslash

* support both label details and non-label details in object literal method snippets

* CR fixes

* fixes after rebasing

* fix tsserver tests
2022-03-30 12:45:56 -07:00
Gabriela Araujo Britto
e25f04a30f Enable method signature completion for object literals (#48168)
* skeleton of new feature

* working prototype

* refactor print and format code into its own function

* minor changes; don't support overloads

* have two completion entries

* get rid of accessor support

* add snippet support

* add formatting

* add trailing comma

* add sourcedisplay

* support auto-imports via completion details

* add user preference option and fix ordering of entries

* cleanup

* don't return code actions for no import fixes

* make sortText lower priority for snippets

* get rid of flag

* use optional member sort text

* update baselines

* don't collect method symbols if insert text is not supported

* remove comment

* return undefined if type is not function type

* only slice if needed

* use union reduction; more test cases

* WIP: modify sort text system

* Improve new sort text system

* add signature and union type check

* re-add flag

* fix tests

* rename sort text helper

* fix test and code for union case

* add new flag to protocol type

* fix spaces

* CR: minor fixes

* CR: more fixes

* CR: restructure main flow

* minor fix
2022-03-29 17:19:02 -07:00
Andrew Branch
7ec7d6d8e0 Fix string literal completions when a partially-typed string fixes inference to a type parameter (#48410)
* Add failing test

* Fix string literal completions when a partially-typed string fixes inference to a type parameter
2022-03-29 09:07:38 -07:00
Andrew Branch
d962091d94 Fix newline inserted in empty block at end of formatting range (#48463)
* Fix newline inserted in empty block at end of formatting range

* Clean up

* Fix refactoring mistake
2022-03-28 13:50:17 -07:00
Wesley Wigham
a5dae37943 Prevent looking up symbol for as const from triggering an error (#48464) 2022-03-28 12:53:36 -07:00
Oleksandr T
0cc3535cae revert #44956 - remove hyphen separator (#48416) 2022-03-25 08:21:57 -07:00
Oleksandr T
49a12dcbbb fix(47081): show completion list in parenthesized object literal arguments (#47104) 2022-03-24 15:30:26 -07:00
Wesley Wigham
b5a3a058f5 Merge diagnosticsProducing and nonDiagnosticsProducing checkers into a single checker supporting lazy diagnostics (#36747)
* Merge diagnosticsProducing and nonDiagnosticsProducing checkers into a single checker supporting lazy diagnostics

* Fix lint
2022-03-23 16:21:06 -07:00
Minh Quy
4ec16b2a6b Fix#48281 - Indentation not respected when executing various refactorings (TypeScript/JavaScript) (#48340)
* fix(48281) - Preserve indentation when adding missing properties

* fix(48281) - Fix object literal indentation like block

* fix(48281) - Indentation for object literal started with curly brace similar to block
2022-03-23 10:40:50 -07:00
Andrew Branch
5bc8179b73 Make AutoImportProvider look in ATA cache (#48329)
* Make AutoImportProvider consider ATA cache

* Delete unnecessary test
2022-03-21 17:02:44 -07:00
Andrew Branch
df1faa09b8 Add isolatedModules error for ambiguous imports referenced in decorator metadata (#42915)
* Add isolatedModules error for ambiguous imports referenced in decorator metadata

* Improve test and accept baselines

* Error only for es2015+

* Add namespace import to error message as workaround

* Add codefix

* Fix merge fallout
2022-03-17 12:00:23 -07:00
Minh Quy
b996287e00 fix(48191): Duplicates comments on "Add definite assignment assertion to property" (#48299)
* Suppress leading and trailing comments for adding missing definite assignment assertion action

* Suppress leading and trailing comments for adding missing initalizer action

* Test for initializer property action
2022-03-17 09:57:10 -07:00
Gabriela Araujo Britto
cf8ed8fec1 Change sortText for class member completions (#48196)
* change sortText for class member completions

* update test

* create new sort text member for class snippets

* change values of sort text enum
2022-03-16 16:04:08 -07:00
Oleksandr T
f12922c8f7 fix(48277): show parameter type inlay hints after ? operator (#48283) 2022-03-16 11:38:40 -07:00
Jesse Trinity
111ca92646 Fix parser regression for bad related diagnostic on missing matching brackets (#44158)
* Revert "Revert #43460 and #40884 (#44175)"

This reverts commit 5770434891.

* fix missing opening brace match error

* refactor parseExpectedMatchingBrackets

* use getNodePos

* accept baselines

* delete mistakenly added files

* Revert getNodePos addition

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-03-15 17:29:41 -07:00
Wesley Wigham
3f63804878 Make direct assignments to cjs exports considered literal contexts (#39816)
* Make direct assignments to cjs exports considered literal contexts

* Style feedback from PR

* Trailing whitespaaaaace
2022-03-09 13:27:39 -08:00
Jake Bailey
d8b21a8d6c Don't crash on non-literal computed property names during getPropertyAssignment (#48079) 2022-03-07 14:18:55 -08:00
Oleksandr T
5f9f9e3752 fix(44477): emit full path to access expressions in comments (#44545)
Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-03-04 11:22:46 -08:00
Jake Bailey
4abad556be Prevent crash on code fixes on default keyword (#48028) 2022-03-04 10:43:04 -08:00
Gabriela Araujo Britto
e64f04bd8c Fix modifier order for class member completions (#48066)
* fix modifier order & tests

* remove empty replacement span from tests
2022-03-01 10:05:24 -08:00
Jake Bailey
e4fe50cca4 Fix incorrect parser error assumption in semicolon handling leading to incremental parser brokenness (#48067) 2022-02-28 17:05:32 -08:00
Zzzen
41b981c998 fix(47853): Convert to template string issue (#47976) 2022-02-28 10:40:48 -08:00
Zzzen
dda65830de go-to-type-definition, and find-all-refs should work for import.meta (#44364)
* go-to-type-definition, and find-all-refs should work for import.meta

* search `meta` instead of `import.meta`

* remove `definition`

* fix compilation error

* update baseline

* revert definition
2022-02-25 09:02:06 -08:00
Oleksandr T
aa920c00f2 fix(47296): add outlining spans for parenthesized expressions (#47307) 2022-02-22 12:12:12 -08:00
Nathan Shively-Sanders
5150682a58 Only suggest @param codefixes in TS (#47959)
* Only issue @param suggestions with codefixes in TS

Previously, there were 2 JS errors that were issued as suggestions in TS
files. But there was no codefix for these errors, and the errors were
incorrect in TS.

This PR only issues the JS-specific errors on JS files.

* Minimise test
2022-02-18 15:58:09 -08:00
Oleksandr T
b0b8cdafc9 feat(44956): remove hyphen separator (#47777) 2022-02-18 13:41:36 -08:00
Oleksandr T
51d34466e7 feat(47281): use unknown type instead of any (#47308) 2022-02-17 13:54:02 -08:00
Oleksandr T
1c06ef38b8 fix(47391): omit | token from jsdoc linkTag text (#47575) 2022-02-17 11:35:09 -08:00
Oleksandr T
5b947e6526 feat(47619): add support for extracting jsx string literal attribute to a constant (#47624) 2022-02-17 11:30:52 -08:00
Oleksandr T
03a4df7a57 fix(47820): forbid extraction jsdoc (#47830) 2022-02-16 16:38:11 -08:00