Commit graph

1191 commits

Author SHA1 Message Date
Paul Gschwendtner b26f77a703
Do not incorrectly add line separators for non-synthetic nodes when emitting node list (#44070)
As of 3c32f6e154, a line separator is
added between nodes if the nodes are not synthetic and on separate
lines. This it push s wrong and previously only happened if the non-synthetic
nodes were on different lines but had the same parent.

Fixes #44068.
2021-06-04 09:46:23 -05:00
Sheetal Nandi 9df7ecb38b
Handle strict flag when writing tsbuildinfo (#44394)
* Add test showing how setting strict is not preserved in tsbuildinfo
Test for #44305

* Handle strict flag when writing tsbuildinfo
Fixes #44305

* Apply suggestions from code review

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-03 16:14:58 -07:00
Orta Therox 9d345e7734
Rename TSConfig option categories (#42514)
* Update the category descriptions for the tsconfig options

* Gets tests green

* Whitespace change

* Drop command line options from --init

* Go back to the old re-build baseline

* Fix numbers

* Remove formatting options from --showconfig

* Dpon't show output formatting changes in showConfig

* Update baselines

* Update baselines
2021-06-03 12:21:04 +01:00
Sheetal Nandi d2516fa95b
Tsserver tests can be baselined (#44326)
* Tests to baseline tsserver instead of checking
Also ensures inferred and auto import projects have name per project service

* Log structureIsReused value

* more baselines
2021-06-02 11:22:01 -07:00
Oleksandr T 1f4c8708c2
fix(44123): forbid convert to async for generator callbacks (#44147) 2021-05-28 14:42:09 -07:00
Sheetal Nandi 817e45d1c1
Dont update timestamps of output files if noEmit was specified (#44306)
* Add failing test for #44303

* Dont update timestamps of output files if noEmit was specified.
Fixes #44303
2021-05-27 17:09:30 -07:00
Sheetal Nandi 8721dd06f1
Add type brands for fileId and fileIdListId (#44280) 2021-05-27 11:15:13 -07:00
Sheetal Nandi 6329a0df90
Add traces for module resolution reuse (#44282) 2021-05-27 11:14:12 -07:00
Andrew Branch b1eaf3e170
Ensure AutoImportProviderProject can share source files with main program (#44274)
* Ensure AutoImportProviderProject can share source files with main program

* Revert package-lock change

* Add back reclassified options
2021-05-26 16:47:40 -07:00
Sheetal Nandi 2ffd35de4d
More updates to program reuse with different option changes (#44276) 2021-05-26 15:57:43 -07:00
Sheetal Nandi b7b4856944
Refactor tsbuild watch tests (#44258) 2021-05-25 17:01:06 -07:00
Oleksandr T db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Ikko Ashimine 493ec4cc26
Fix typo in host.ts (#43930)
encounted -> encountered
2021-05-13 14:00:26 -07:00
Sheetal Nandi 182b6c90d6
Test for Update the type reference cache with correct project options (#44008)
* Test without change

* Update showing fix in #44004 works
2021-05-10 12:29:36 -07:00
Ron Buckton cb9cd898d1
Revert #35877 - fix receiver on calls of imported and exported functions (#43993) 2021-05-07 13:42:12 -07:00
Sheetal Nandi e5395efe49
Add writeFile and customTransformers to build and buildReferences (#43984) 2021-05-07 12:13:17 -07:00
Sheetal Nandi cfed79b7a2
Correctly use ownMap from module resolution cache (#43986)
* Test showing the moduleResolutionCache reset issue with tsc --b --w

* Fix incorrect usage of ownMap by making it function returning ownMap instead of constant value
2021-05-07 09:56:29 -07:00
Sheetal Nandi 233f28ca27
When directory watcher is invoked with any file from node_modules package, invalidate for file paths in that package (#43974)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-06 09:48:26 -07:00
Oleksandr T e0d7703cf3
fix(43939): forbid converting getters to async/await (#43944) 2021-05-06 01:48:54 -07:00
Sheetal Nandi f7ef1540d3
Use options from referenced project for including resolved imports in the file when using sources of project reference (#43914)
* Test where allowJs present in referenced project affects picking up right set of import files

* use options from referened project for including resolved imports in the file when using sources of project reference
Fixes #43909
2021-05-03 11:35:21 -07:00
Sheetal Nandi c96b472e0b
Handle localness in special cases by checking exported variable assignment (#43851)
* Handle localness in special cases by checking exported variable assignment
Fixes #42976

* Fix existing tests where arrow now behaves similar to function expression

* Update src/services/goToDefinition.ts
2021-04-30 13:17:59 -07:00
Sheetal Nandi f6d425e1e3
Module Resolution and Type Reference directive cache updates and its API changes (#43700)
* Make the module resolution cache apis for updating compiler options or clearing it

* Cache package.json lookup results from module resolution

* Use per directory cache for type reference directive resolution as well

* Update Baselines and/or Applied Lint Fixes

* Change trace according to feedback

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-21 21:30:18 -07:00
Josh Goldberg a910c8df13
Added skipDestructiveCodeActions argument to organize imports server command (#43184)
* Stopped removing unused imports in files with syntactic errors

* Added allowDestructiveCodeActions arg

* Updated .d.ts baselines

* Stop factoring syntax errors. Weird that no tests break...

* Have args extend scope so it is not a breaking change

* Update src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>

* Fixed API breaking change, and renamed to skip

* Always with the baselines

* One more .d.ts baseline to fix

* Remove blank line in src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
2021-04-20 09:04:17 -07:00
Sheetal Nandi 01264ac414
Reducing tsbuildinfo size further (#43695)
* Serialize compiler options that are needed from old state when creating new state

* Dont write affectsGlobalScope if not true

* Encode FileInfo for better serialization size

* Update src/compiler/builder.ts

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-16 23:22:14 -07:00
Andrew Branch f74f9cac13
Add telemetry properties for import statement completions (#43664) 2021-04-13 16:17:52 -07:00
Sang a354a77030
Improve rendering of JSDoc comment text with displayparts (#43390)
* feat(services): jsdoc use custom name for display parts

* fix(services): jsdoc typo

* feat(services): revert jsDoc changes

* feat(services): jsdoc improve displayparts with more comment kinds

Improve rendering of JSDoc comment text with displayparts for:

- `@typedef`
- `@callback`
- `@param`
- `@property`

* feat(services): jsdoc improve displayparts for template

* test: accept baseline

* test: update jsdoc parameterName

* feat: resolve pr comments

* test: add fourslash tests for jsdoc callback, typedef

* test: accept baselines

* test: revert changes for api baselines

* refactor: naming

* refactor: code quality

* refactor: clean up code as to pr comments
2021-04-09 09:44:44 -07:00
Josh Goldberg fe4a6709da
Specified diagnostic for CLI flags mismatched with/out --build (#43199)
* Specified diagnostic for CLI flags missing a required --build

* Switched to an alternateMode member

* Added --build-incompatible flags too

* Small fixups to remove a hardcoding

* Switched to ||= factories

* Not a function

* I think I get it now
2021-04-07 16:03:17 -07:00
Titian Cernicova-Dragomir 2484210a00
Gh 41788 incorrect output for esprivate with nested class in esnext (#42663)
* If target:esnext,then useDefineForClassFields: true will now be the default.

* Added error if a private identifier is used in a static a initializer if target:ESNext and useDefineForClassFields:false.

* Added test for new useDefineForClassFields default and error message.

* Fixed tests after changing the default of useDefineForClassFields to true for target esnext

* Fixed code review suggestions.

* Updated error message.

* Added missing static check for the containing property. Fixed other code review issues.
2021-04-07 08:23:16 -07:00
Andrew Branch ffe925ddd5
Go to definition: pass unverified through server (#43483)
* Pass `unverified` through server

* Update protocol baseline

* Fix unit tests

* Fix other tests
2021-04-05 13:42:25 -07:00
Sheetal Nandi 4b556e37db
Handle document Registry to distinguish between files with same name and document registry key(compiler options affecting source file) but different ScriptKind (#43474)
* Test that fails because of change in scriptKind of untitled file

* buckets are keyed with DocumentRegistryBucketKey

* Use scriptKind in document Registry to distinguish between files
Fixes #42613
2021-04-05 13:27:34 -07:00
Oleksandr T 5268264e64
fix(43316): omit to suggest converting to async function if a void is explicitly returned (#43358) 2021-04-05 11:09:33 -07:00
Sheetal Nandi d51b8cff6a
Do not delete output file names that are same as input file name (#43448)
* Add failing test case

* Do not delete output file names that are same as input file name
Fixes #43116
2021-03-30 16:04:25 -07:00
Andrew Branch 2d6a490363
Import statement completions (#43149)
* WIP

* WIP

* Get completion details working

* Start unifying eager and lazy auto imports

* Fix export=

* Fix completion details for totally misspelled names

* Almost fixed duplication...

* Fix remaining completion tests

* Refactor to support multiple origins for same symbol

* Make import fixes make slightly more sense

* Add cache back in

* Set insertText based on import kind

* Update API baselines

* Add semicolons, snippet support, and sourceDisplay

* Add some tests

* Update baselines

* Fix pattern ambient modules appearing in auto imports

* Fix tests

* Remove commented code

* Switch to valueDeclaration for getting module source file

* Small optimizations

* Cache module specifiers / importableness and export map separately

* Fix and test cache invalidation logic

* Update API baselines

* Add separate user preference for snippet-formatted completions

* Require first character to match when resolving module specifiers

* Fix AutoImportProvider export map cache invalidation

* Really fix auto import provider export map invalidation

* Update test added in master

* Use logical or assignment

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Simply conditional by reversing

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* When file is deleted need to marked correctly in the project as removed file

* Simplify hasAddedOrRemovedSymlinks with cherry-picked fix

* Ensure replacement range is on one line

* Update baselines

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2021-03-26 14:47:07 -07:00
Sheetal Nandi a545ab1ac2
Cache resolved project references and watch wild card directories from them to update them (#42929)
* Test for not watchiong referenced projects fileNames and invalidating it

* Add watching wild card directories and caching parsed command line for projects so that its shared

* Handle config file watching and commandline cache together

* Watch extended files for commndline cache instead of project

* Use extended config cache now that we are watching extended config files

* Structure for getParsedCommandLine from the LS

* Adding some more skeleton with todos

* getParsedCommandLine on WatchCompilerHost

* Tests for Watch, LS scenarios

* Handle getParsedCommandLine so we are looking at all things for referenced

* Cleanup and commenting

* Test for transitive references with tsc-watch

* Cache parsed command line even if host implements getParsedCommandLine

* Cleanup

* Cleanup

* Some tests to verify exclude from referenced project doesnt trigger the update

* Baseline when program is same

* Test for incremental scenario

* Tests for output from referenced project

* Comments
2021-03-26 13:23:03 -07:00
Sheetal Nandi 04205ca32c
Do not calculate signatures if old state is not used (#43314)
* Extra tests in preparation for lazy signature making sure the original intent of test is maintained

* Whenver we cant use state delay signature calculation and use source file version as signature

* Incremental correctness checks

* Retain old behavior in compile on save by disabling use of file version as signature in when state is not reused
2021-03-23 13:43:43 -07:00
Nathan Shively-Sanders dcc27ebaf2
@link support, second try (#43312)
* Revert "Revert "Editor support for link tag (#41877)" (#43302)"

This reverts commit 451d4354b9.

* Fix parsing @link at end of comment

* Parse comments as string when no @link occurs

* fix lint
2021-03-22 16:39:35 -07:00
Josh Goldberg 5813907abf
Made TS6059 rootDir validation consistent for programmatic usage (#43145)
* Made TS6059 rootDir validation consistent for programmatic usage

* Corrected other baselines
2021-03-19 15:52:04 -07:00
Nathan Shively-Sanders 451d4354b9
Revert "Editor support for link tag (#41877)" (#43302)
This reverts commit ec77bff332.
2021-03-18 14:42:25 -07:00
Nathan Shively-Sanders ec77bff332
Editor support for link tag (#41877)
* Initial scribbles

* Compiles but provides spans instead of location pairs

Probably need to fork the services/server types and provide a conversion
with Session.toFileSpan. Not sure where to put the conversion.

* Switch to DocumentSpan

In theory this is already better supported, but not sure practise bears
that out.

* Builds w/protocol types + conversions

* cleanup:better names and scrub TODOs

* fix test harness too

* Misc

1. Simplify protocol after talking to @mjbvz.
2. Add more tests.
3. Initial notes about where to add parsing.

* Parse and store links in the compiler

The text of the link is still stored in the comment text, but that's now
kept in an object instead of just a string. Each link has the parse for
the entity reference, if there is one.

Needs lots more tests -- this just makes all the existing jsdoc tests
pass.

* more tests and some fixes

* Fix other failing tests

* fix bad merge

* polish parser

* improve names and array types

* slight tweaks

* remove some done TODOs

* more tests + resulting fixes

* add+fix cross-module tests

* Support `@see {@link`

Plus find-all-refs support equivalent to @see's.

* add server test

* Make comments actually part of the AST

* Add span for link.name in language service/protocol

* Make checker optional in getJSDocTags

Also change to JSDocCommentText from JSDocCommentComment

* Use getTokenValue instead of getTokenText

Measure twice, slice once

* Add missing support for top-level links

The language service and protocol were missing support for top-level
links. This commit adds that plumbing.

* add string back to comment type in node constructors

* Full parse of link tags and jsdoc comment text

- Doesn't pass fourslash yet, I'm going to switch to baselines for
  failures there.
- Still needs some work on the protocol to convert file+offset to
  file+line+offset.

* fix lint

* Fix missing newlines in inferFromUsage codefix

* Parse jsdoc comments as text node/link array

And switch to line+character offsets in the protocol

* Fix fourslash tests

Mostly ones that can't be baselined, but I switched a couple more over
to baselines

* Improve types and documentation

* Test+fix @link emit, scrub other TODOs

* update API baselines

* test that goto-def works with @link

* Split link displaypart into 3

One for link prefix and suffix, one for link name, and one for link
text.

* update baselines

* Provide JSDocTagInfo.text: string to full clients by default

Instead of upgrading them to displayparts.

* Real server tests

* Disambiguate {@link} and @param x {type}

They are ambiguous; previously the parser preferred the type
interpretation, but will now look ahead and parse links instead when the
prefix is `{@link`.

* Add explanatory comment in test

* fix location in richResponse in protocol

* update API baseline

* Address PR comments

1. Add a cross-file goto-def test.
2. Switch from per-message args to UserPreference.

* use arraysEqual from core
2021-03-16 16:26:01 -07:00
Sheetal Nandi 53cbc046d2
Refactor the test for easy maintainability (#43262) 2021-03-15 18:04:30 -07:00
Sheetal Nandi d2cb05a6b5
Emit readable BuilderFileEmit kind (#43221) 2021-03-12 14:32:50 -08:00
Sheetal Nandi 82bfe5ad93
Fix issue with some baselines for tsbuildinfo not getting generated (#43218) 2021-03-12 12:28:20 -08:00
Sheetal Nandi 496a1d3caa
Improvements to dts emit for tsbuildinfo (#43205)
* Test update

* Use source file version as default signature for the file whenever there is no dts emit for the file

* json source files from project reference should be able to calculate the signature

* Dont emit declaration map when emitting dts files for force emit for signature
2021-03-12 09:44:22 -08:00
Sheetal Nandi 9933c8ac7d
Build info baseline improvements (#43200)
* Use ids as 1 based so we can specialize `0` to be some special meaning

* Baseline tsbuildinfo size in the readable baseline

* Baseline fileName and fileNames list as well in readable tsbuildinfo so that new additions are easy to recognize
2021-03-11 13:30:06 -08:00
Kagami Sascha Rosylight f4d0ea6539
Add target: ES2021 (#41239)
* Support `target: es2020`

* use CRLF

* update symbols

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-10 13:31:25 -08:00
Sheetal Nandi acc8f2fb05
Ensure that when new file affecting global scope is added, the signatures are updated (#43084)
* Ensure that when new file affecting global scope is added, the signatures are updated

* Update src/compiler/builder.ts

* Better comment
2021-03-09 17:40:02 -08:00
Sheetal Nandi 6e4456b3b4
Optimize the size for tsbuildinfo (#43155)
* Baseline readable buildinfo

* Use file names as index in file name list
This is extension of the idea given by @sokra to optimize size of tsbuildinfo

* Deduplicate reference map lists and use file name index to sort them
Different implementation of #43079 based on idea suggested by @sokra

* Minimal json.stringify for the tsbuildinfo
Again implementaion of suggestion by @sokra

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

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>

* Readable version of buildinfo all the time

* Some renames for readability as per feedback

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-03-09 16:15:26 -08:00
Klaus Meinhardt 15e69acc20
capture thisArg of optionalChaining in parens (#35494)
Fixes: #35476
2021-03-03 19:35:17 -08:00
Klaus Meinhardt 7751ecb544
fix receiver on calls of imported and exported functions (#35877)
* fix receiver of imported and exported functions

fixes: #35420

* Rebase against master and clean up substitution flow

* Add evaluator tests

* Fix evaluator tests

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-03-03 10:38:32 -08:00
Sheetal Nandi 0cf834ceec
Move fixed chunk size polling as a watch option and move it out of server (#42542)
* Move fixed chunk size polling as a watch option and move it out of server
Fixes #41549

* Feedback
2021-03-02 16:45:53 -08:00