Commit Graph

6445 Commits

Author SHA1 Message Date
Gabriela Araujo Britto
67a3846fbf Fix replacementSpan for class member snippet completion entries (#52231) 2023-01-16 10:32:24 -08:00
Oleksandr T
86ccd20e53 fix(52212): No member completions, and irrelevant value completions, when class property initializer has no semicolon (#52213) 2023-01-13 14:23:36 -08:00
Ron Buckton
9cdba994ac Remove some properties from Identifier (#52170) 2023-01-12 17:20:12 -05:00
Oleksandr T
6860373c1a fix(52177): Wrong space in type assertions when using array (#52184) 2023-01-11 14:59:22 -08:00
Wesley Wigham
89e928e8b4 Add --allowArbitraryExtensions, a flag for allowing arbitrary extensions on import paths (#51435) 2023-01-09 17:12:42 -08:00
Oleksandr T
394a777fdd fix(51963): Invalid property read for find-all-references when exporting non-existent binding (#52006) 2023-01-09 15:29:33 -08:00
Vitaly
4b69e1342e Basic JSX attribute snippet fixes (#51855)
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2023-01-09 09:13:27 -08:00
Jake Bailey
f1ff0de943 Use native generators/iterables, remove helper cruft (#51921) 2023-01-06 14:40:56 -08:00
Oleksandr T
c57fea2a0d fix(52050): The space before satisfies after an array expression is removed when auto-formatting the statements (#52053) 2023-01-05 13:30:11 -08:00
Oleksandr T
44152bc22e fix(29648): Error message related to JSDoc for non-JSDoc syntax error (#50793)
* fix(29648): improve diagnostics of non-JSDoc syntax errors

* fix lint errors

* update tests

* change diagnostic type suggestion. fix QF for jsdoc nullable type

* move error handling from the parser to the checker

* change diagnostic message. remove speculative parsing

* update baseline
2022-12-29 16:50:57 -08:00
Andreas Buob
8b6f8730c1 fix(51223): Go-to-definition for yield and await keyword; jump to respective function definition (#51838) 2022-12-20 13:29:59 -08:00
Oleksandr T
6f4d340458 fix(51716): find all references in imported JSDoc types (#51729) 2022-12-20 13:16:17 -08:00
Mateusz Burzyński
cf68a12d69 Improve string literal completions for property values when a partially-typed string fixes inference to a type parameter (#51770) 2022-12-20 13:08:55 -08:00
Gabriela Araujo Britto
0f5e037e1d pass isSingle quote preference when building string literal (#51968) 2022-12-19 15:39:39 -08:00
Ron Buckton
eb1e257072 Support outlining in multiline import/export decls (#51937) 2022-12-19 15:22:43 -08:00
Josh Goldberg
2484390af8 Added override keyword to codefix implemented abstract methods (#51033)
* Added override keyword to codefixed implemented abstract methods

* Only when noImplicitOverrides is true, and always check abstract modifier

* Added test on abstract/override already being there

* Added back a few test cases

* Check declaration modifier, not class modifier
2022-12-16 11:59:21 -08:00
Oleksandr T
193a8a74c8 skip optional parameters in js files (#51924) 2022-12-16 11:51:41 -08:00
Oleksandr T
645b3ddb06 fix(51920): skip TypeScript types in js files (#51922) 2022-12-16 10:35:35 -08:00
Ron Buckton
44e8244dd9 Move auto-generated identifier info into separate object (#51900) 2022-12-15 13:59:57 -05:00
Andrew Branch
e0bfac531b Rename module resolution option node to node10 (preserving backward-compatible alias) (#51901)
* Rename `node` to `node10` (preserving alias)

* Revert dogfooding change because of LKG

* Update baselines
2022-12-15 10:07:33 -08:00
Ron Buckton
2993ea8eaa Monomorphic Symbol access (#51880) 2022-12-15 10:44:24 -05:00
Andrew Branch
4076ff8fd6 Add option for organize imports case sensitivity (#51733)
* Add ignore case option to organizeImports

* Adopt in auto-imports, use same case-insensitive comparison as eslint

* Fix build/lint

* Mark functions internal

* Update affected auto import test

* Update API baseline

* Update protocol

* Update API baseline

* Short-circuit comparisons that have already failed
2022-12-13 14:37:29 -08:00
Andrew Branch
a5dde88dce --moduleResolution bundler (formerly known as hybrid) (#51669)
* WIP

* Add extension error back unless noEmit is set

* Add non-relative tests

* Add error for importing from declaration file

* Update unit test

* Add explicit flag for importing from .ts extensions

* Add module specifier resolution changes

* Add auto-import tests

* Disallow relative imports into node_modules

* Ensure auto-imports don’t suggest ./node_modules;

* Test a non-portable declaration emit issue

* Test auto-importing TSX file

* Update path completions

* Fix lint due to merge

* Remove minimal-specific stuff

* Remove minimal tests

* Update unit tests

* Add options

* Add customConditions option

* Add first tests

* CJS constructs are not allowed

* Add another test

* Fix extension adding/replacing priority

* Update test to reflect the choice not to block on unrecognized extensions

* Add auto-imports and string completions tests

* Revamp string completions ending preferences

* Comment test

* Auto-imports of declaration files cannot use .ts extension

* Have declaration file auto imports default to extensionless instead

* Add test for custom conditions

* Fix indentation

* Add baseline showing resolvePackageJsonImports/Exports compatibility

* Fix test and prevent CJS require from resolving

* Update unit test baselines

* Fix bad merge conflict resolution

* Make resolvedUsingTsExtension optional

* Update missed baselines

* Revert now-unnecessary API implementation changes

* Clean up

* Update baselines to es5 emit

* Rename to `bundler`
2022-12-13 13:35:16 -08:00
Gabriela Araujo Britto
ad354c2d75 Don't include already-covered cases in switch completions (#51790)
* WIP: filter existing values in case completions

* filter existing enum symbols

* add comment

* fix lint errors

* update baselines

* add comment
2022-12-13 13:01:52 -08:00
Ron Buckton
6d41964fd0 Reduce polymorphism resulting from unstable Node shapes (#51682)
* Move .symbol to Declaration

* simplify some factories

* Move localSymbol to Declaration

* Ensure JSDocContainer types are properly initialized

* Move contextualType from Node to NodeLinks

* Move 'locals' and 'nextContainer' out of Node

* Move 'flowNode' out of 'Node'

* Pre-define endFlowNode/returnFlowNode

* Pre-define some SourceFile properties and a more stable cloneNode

* Don't add excess properties to type nodes in typeToTypeNode

* Refactor wrapSymbolTrackerToReportForContext to improve perf
2022-12-13 15:11:10 -05:00
navya9singh
7267fcaeb9 Fix(29118): tsconfig.extends as array (#50403)
* tsconfig.extends as array

* Updated baselines

* Changes for pr

* Changes for pr comments

* Fixed formatting and edited a test

* Resolved errors after a merge conflict

* Added "string | list" type implentation

* Removed string | list type implementation

* Fixed formatting

* Added compiler test

* Resolving programUpdate errors

* Fixing commandLineParser error
2022-12-13 11:16:07 -08:00
Oleksandr T
790c03d7b0 fix(47954): Auto implementation of interface with a constructor prop causes error (#50709)
* fix(47954): convert constructor property to computed name

* handle more nodes with constructor name
2022-12-12 15:28:03 -08:00
Oleksandr T
d54f52e0de fix(50089): JSDoc/TSDoc @link with custom display text incorrectly shows vertical bar (#50106)
* fix(50089): omit | from jsdoc linkTag text

* change finding for the end pos of a link
2022-12-12 15:16:29 -08:00
Oleksandr T
355991c806 feat(49323): Render JSDoc @throws {type} as a link (#49891)
* feat(49323): add support throws jsdoc tag

* change "name" to "typeExpression". parse "exception" as a synonym for "throws"

* include typeExpression from the throws tag in the quick info

* add JSDocThrowsTag to ForEachChildNodes
2022-12-12 14:44:38 -08:00
Oleksandr T
1f32fef5a2 fix(51077): skip insertText for jsx attribute with existing initializer (#51093) 2022-12-09 08:38:08 -08:00
Oleksandr T
e087992134 feat(47977): show completion in jsdoc extends/implements tags (#51028) 2022-12-08 17:10:00 -08:00
Oleksandr T
8f2ee38b52 fix(50888): Organize Imports may delete preceding comments when all members of all import statements are unused (#50983)
* fix(50888): preserve preceding comments of the deleted import

* update tests
2022-12-08 17:05:12 -08:00
Sheetal Nandi
3716ffe748 Make getSupportedCodeFixes on LS so it can be proxied by plugins (#51769)
Fixes #28966
2022-12-08 09:52:25 -08:00
Andrew Branch
dc3daa6644 Fix namespace import update bug, simplify, comment, and rename (#51797) 2022-12-06 16:38:33 -08:00
Gabriela Araujo Britto
a1536358f7 fix & test (#51792) 2022-12-06 16:18:01 -08:00
Isabel Duan
ae9c671d59 (fix #50725, #50710) add file extensions in import statements (#51702)
* fixes #50725

* fixed 50710

* fixed broken test

* clean up

* variable rename

* rename variable to newFileBaseName
2022-12-06 09:28:10 -08:00
Wesley Wigham
b23b29b71b Use formatting newline rather than host newline in extractType (#51764) 2022-12-05 12:47:36 -08:00
Lyu, Wei-Da
0c09d2f172 quick fix for a nullable missing callback function (#51743) 2022-12-05 12:23:59 -08:00
Sheetal Nandi
9e845d2248 Api cleanup for Module and Type Reference directive resolution (#51546)
* Refactoring so CacheWithRedirects has Key and Value type parameters

* ModuleResolutionCache or TypeRefDirectiveCache will look in directory before solving, so ResolutionCache doesnt need this check

* Test showing module resolution is not shared because resolution cache doesnt update own options

* Enable traceResolution on some of the project reference tests

* Simplify CacheWithRedirects and ensure the options are set in all common scenarios so cache can be shared between redirects

* Make failedlookup etc optional in ResolvedModule/TypeRefefWithFailedLookupLocations
Also make accidental public failed lookup internal

* Add new API for module and type ref resolution

* Store auto type reference resolutions

* Modify test to show how using program partially doesnt report resolution diagnostics

* Ensure that resolution diagnostics are reported in filePreocessingDiagnostics so they can be reused when program is reused

* Some cleanup

* Remove the newly added ReoslutionInfo in favor of new APIs

* update
2022-12-05 11:56:33 -08:00
Gabriela Araujo Britto
6a3c9ea125 Exhaustive case completion for switch statements (#50996)
* fix services' type's isLiteral

* update literal completions tests

* initial prototype

* use symbol to expression. TODO: filter existing, replace import nodes

* WIP

* WIP

* remove booleans from literals

* trigger at case keyword positions

* clean up tests

* fix element access expression case

* refactor dealing with existing values into a tracker

* fix merge errors

* cleanup and more tests

* fix lint errors

* more merge conflict fixes and cleanup

* use appropriate quotes

* small indentation fix

* refactor case clause tracker

* experiment: support tabstops after each case clause

* address small CR comments

* fix completion entry details; add test case

* fix lint errors

* remove space before tab stops; refactor
2022-12-01 16:48:32 -08:00
Oleksandr T
1b75edcec6 fix(51053): Extract type on JSDoc causes an assertion failure (#51056)
* fix(51053): allow extract type from the jsdoc without a host

* change diagnostic message
2022-12-01 16:09:31 -08:00
Sheetal Nandi
7b7f6a75ea Code refactoring for module resolution api (#51675)
* Refactoring so CacheWithRedirects has Key and Value type parameters

* ModuleResolutionCache or TypeRefDirectiveCache will look in directory before solving, so ResolutionCache doesnt need this check

* Test showing module resolution is not shared because resolution cache doesnt update own options

* Enable traceResolution on some of the project reference tests

* Simplify CacheWithRedirects and ensure the options are set in all common scenarios so cache can be shared between redirects
2022-12-01 10:17:58 -08:00
Andrew Branch
e6d7b526c8 Fix multiline import specifier sorting (#51634)
* Fix multiline import specifier sorting

* Update baselines

* Switch to EmitFlag, set hasTrailingComma on original node array

* Update API baseline

* Update baselines
2022-11-28 15:35:32 -08:00
Sheetal Nandi
c1427c90b6 Convert reuse program structure and tracing of module resolution to baseline for easier updates (#51628)
* Modify all usages of file name lower casing to use custom lower casing method

* Baseline reuse program structure tests for easy update when making changes to module resolution
2022-11-22 20:58:21 -08:00
Jake Bailey
00dc0b6674 Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8 Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Anders Hejlsberg
7b85cd6b72 Numeric literals assignable to enum literals only when values match (#51561)
* Numeric literal assignable to enum literal only when values match

* Accept new baselines

* Update compiler sources

* Accept new baselines

* Fix test runner

* Any numeric literal type is assignable to a computed numeric enum type
2022-11-16 18:56:01 -08:00
Sheetal Nandi
2f2a17ad0b Removing some unnecessary methods from host and function parameters (#51499) 2022-11-15 17:34:58 -08:00
Sheetal Nandi
c5aea89230 Add alias ResolutionMode for ModuleKind.ESNext | ModuleKind.CommonJs | undefined (#51482)
* Add alias ResolutionMode for ModuleKind.ESNext | ModuleKind.CommonJs | undefined

* ResolutionMode | undefined = ResolutionMode

* More
2022-11-10 16:47:46 -08:00
Jake Bailey
9f64a3a58c Remove ts.{Map,Set,ESMap,Iterator} and associated types (#51439) 2022-11-09 15:06:31 -08:00