Commit Graph
100 Commits
Author SHA1 Message Date
Andrew Casey e8996a34a9 Remove redundant type annotation 2020-11-11 13:56:27 -08:00
Andrew Casey 116000e548 Fold tracing.begin and end into push and pop
Storing the arguments on the stack will make it possible to forego
try-finally blocks when we start tracing in server scenarios, which have
to handle cancellation.
2020-11-11 12:58:00 -08:00
Andrew Casey e712d42e44 Stop doing tracing work when tracing is disabled 2020-10-26 17:27:44 -07:00
Andrew Casey dcb18d6f18 Adopt push-pop API 2020-10-22 11:01:42 -07:00
Andrew Casey 9ad9ec984e Add tracepoint in resolveTypeReferenceDirectiveNamesWorker 2020-10-22 10:58:52 -07:00
Andrew Casey 0b31e487c2 Add tracepoints within createProgram
These were useful during the Midgard investigation.
2020-10-22 10:58:51 -07:00
Andrew Casey 9f5310fd8d Use the existing checkCrossProductUnion helper 2020-09-25 13:37:54 -07:00
Andrew Casey 6650496e85 Enforce a size limit in getSpreadType
When a union is spread into a union, the sizes are multiplied,
potentially resulting in an enormous union (especially if there are
repeated spreads).  This check detects cases that used to run out of
memory.

Fixes #40754
2020-09-24 14:52:42 -07:00
Andrew Casey ef1481c8a4 Correct bottoming-out tracing for recursiveTypeRelatedTo 2020-09-01 16:46:07 -07:00
Andrew Casey 36489ff5c6 Add instantaneous events when depth limits are hit 2020-08-28 15:51:52 -07:00
Andrew Casey d6dda230bc Swallow empty-commit error 2020-08-25 10:16:58 -07:00
Andrew Casey 7b40895b29 Record the recursion ID of each type, if available 2020-08-21 17:39:03 -07:00
Andrew Casey 00804d8aa6 Trace structuredTypeRelatedTo, rather than recursiveTypeRelatedTo 2020-08-21 17:07:13 -07:00
Andrew Casey a0479da1e5 Revert System changes and consume fs directly 2020-08-21 17:07:13 -07:00
Andrew Casey 5d60972ef4 Trace key operations
Produce output in Chrome's event tracing format so that it can be viewed
in Chrome/Edge.
2020-08-21 17:07:12 -07:00
Andrew Casey 4778cda0b2 Delete extra npm update 2020-08-20 18:16:28 -07:00
Andrew Casey c12bc7b906 Update bot email address 2020-08-19 18:01:29 -07:00
Andrew Casey 00d7d52729 Git ignore package-lock.json and forcibly update in workflow 2020-08-19 17:57:22 -07:00
Andrew Casey 4d57d35949 Add a workflow to update package-lock.json daily 2020-08-19 17:16:24 -07:00
Andrew Casey 5bcb353e18 Adopt package-lock.json and npm ci 2020-08-19 16:50:23 -07:00
Andrew Casey 6318cc6d88 Move off deprecated mocha types 2020-07-27 14:29:19 -07:00
Andrew Casey 195fad23a5 Reduce unnecessary error computation
...during overload resolution.  Based on a trace that was spending 30%
of a (very slow) overload resolution elaborating errors that were then
dropped.
2020-07-27 14:11:24 -07:00
Andrew Casey 932b314f81 Delete lib/lib.esnext files no longer found in built/local 2020-06-29 15:46:41 -07:00
Andrew Casey 126a95b37c Delete lib/diagnosticMessages.generated.json
The values are baked in - only the localized json files are needed in
the LKG.
2020-06-29 15:45:33 -07:00
Andrew Casey 590fd3f2a2 Don't assume that all symbols have declarations
...in Find All References.  For example, global `this` doesn't in
modules.

Part of #34404
2019-10-22 15:00:30 -07:00
Andrew Casey 7862e58354 Handle undefined from getPropertyNameForPropertyNameNode
...which can be returned when the property name is computed.

Part of #34404
2019-10-21 17:41:06 -07:00
Andrew Casey af2f46e899 Use longer lambda parameter names 2019-10-21 16:22:10 -07:00
Andrew Casey ca31f008a8 Address more potential this issues 2019-10-21 14:01:12 -07:00
Andrew Casey 6429e4cd36 Fix undefined this 2019-10-21 13:32:42 -07:00
Andrew Casey 7275e9ca93 Delete redundant test 2019-10-17 17:22:47 -07:00
Andrew Casey 526e413abc Dropping assert for 3.7 2019-10-17 16:51:30 -07:00
Andrew Casey 8927aaabb5 Rewrite tests 2019-10-17 16:50:22 -07:00
Andrew Casey 9dd8391244 Add additional properties to switch declaration 2019-10-17 16:36:54 -07:00
Andrew Casey d18130d36b Consolidate checks in emitFilesAndReportErrors 2019-10-17 16:36:54 -07:00
Andrew Casey caf0041f8a Add listFilesOnly command-line option
Msbuild currently uses a combination of `--listFiles` and `--noEmit` to
obtain a list of files to be consumed by tsc.  However, these two flags
don't suppress type checking, the results of which msbuild will never
consume.  This new switch gives msbuild a faster way to obtain the file
list.

Note: like `--noEmit`, doesn't make sense in build mode.
2019-10-17 16:36:50 -07:00
Andrew Casey 205b3dae3b Extract shared helper 2019-10-17 16:26:43 -07:00
Andrew Casey f39b49d756 Update another writeFile call-site 2019-10-17 11:36:45 -07:00
Andrew Casey b6659e5d6e Inline function to tidy up control flow 2019-10-16 11:34:38 -07:00
Andrew Casey 4ed80b62df Stop pre-emptively creating directories
Checking for directory existence is expensive and frequently indicates
success.  Instead of pre-emptively creating the directory containing a
file to be written, attempt to create the file and only do the directory
scaffolding if the write fails.

Appears to reduce file write time by 10-20% for a file-I/O heavy partner
build.

Thanks to @rbuckton for the suggestion!
2019-10-16 11:24:24 -07:00
Andrew Casey 87c905f423 Handle string literals in merge conflict regions
Check for undefined, like the other code paths in the same function.
2019-10-09 14:46:19 -07:00
Andrew Casey f10e38fea7 Make extractSymbol explicitly drop JSDoc nodes
Fixes #33332
2019-09-17 10:35:11 -07:00
Andrew Casey e3690c3a07 Use the in operator 2019-08-23 13:10:32 -07:00
Andrew Casey 00d37268e8 Make triple-slash comment classification more restrictive
It was overly permissive and ended up making a mess of C#-style
comments:

`/// <summary>Text</summary>`

Now it checks the element name.  Attribute names remain unchecked.
2019-08-23 12:55:10 -07:00
Andrew Casey 8c6612b31e Tweak message text 2019-08-09 14:50:24 -07:00
Andrew Casey 6fe6cb3913 Correct string template 2019-08-09 14:32:34 -07:00
Andrew Casey 6c19c13094 Use an explicit type 2019-08-09 14:04:04 -07:00
Andrew Casey 6122e92802 Restore logging of the program file list 2019-08-09 12:34:40 -07:00
Andrew Casey d9780cd7ba Include fewer paths in exception
It's sufficient to append them to the log.
2019-08-09 10:27:02 -07:00
Andrew Casey 9647506d8c Support classification of triple-slash references
Note: not restricted to the element and attribute names that actually
bind
2019-07-25 15:59:17 -07:00
Andrew Casey 2d785c8c91 Make args types internal 2019-06-26 15:09:30 -07:00
Andrew Casey 96fcf1e0c0 Update API baseline 2019-06-21 14:55:29 -07:00
Andrew Casey 2953574eba Use getEncodedSyntacticClassifications 2019-06-21 14:48:22 -07:00
Andrew Casey 6e50853143 Trivially expose getEncodedSyntacticClassifications 2019-06-19 15:48:23 -07:00
Andrew Casey 1bf28f21de Add regression test 2019-06-11 17:50:36 -07:00
Andrew Casey 65881602b6 Correct outline hint spans for functions 2019-06-11 16:58:08 -07:00
Andrew Casey 737fda928c Don't treat interfaces as implementations
...even if they're in ambient contexts.  Same for type aliases.
2019-01-17 15:45:01 -08:00
Andrew Casey 4029e70c97 Illustrate a case that isn't handled correctly 2019-01-16 19:24:51 -08:00
Andrew Casey 3e256e14dc Add fourslash tests 2019-01-16 19:18:25 -08:00
Andrew Casey 7102de77d3 Consider JSX namespace imports when moving statements between files
Each of the old and new files should end up with a JSX namespace import
iff it contains JSX.

Fixes #27939
2019-01-16 18:55:27 -08:00
Andrew Casey 3fb09630a8 Add regression test 2019-01-15 10:55:15 -08:00
Andrew Casey b86cb27d0b Fix trailing whitespace 2019-01-14 18:13:13 -08:00
Andrew Casey 104434182b Harden telemetryOnOpenFile against disabled projects
As for syntax-only servers, we can't meaningfully report open-file
telemetry for projects with disabled language services.

Hopefully, a deeper fix will follow, but this solves the immediate
problem that VS disables the LS for all projects when it sees a failure
in applyChangedToOpenFiles (because it assumes the server state is
corrupt).
2019-01-14 17:43:06 -08:00
Andrew Casey 5c1c34a16e Add telemetry test 2018-11-16 11:00:41 -08:00
Andrew Casey a8c634d70d Restore useText 2018-11-16 10:48:06 -08:00
Andrew Casey 8bfdb4145d Fix tests and lint 2018-11-15 16:00:35 -08:00
Andrew Casey d5b95b5904 Update API baseline 2018-11-15 15:54:21 -08:00
Andrew Casey 2c7d67fded Expose aggregate file sizes in FileStats
We're not sure that file counts are a good proxy for project size and
this will give us more direct insight.
2018-11-15 13:56:24 -08:00
Andrew Casey 02d5cb045c Expose file size from TextStorage
Since it's for telemetry, it prefers to return a stale value rather than
triggering file IO (though it will load the file if not even a stale
value is available).
2018-11-15 13:56:24 -08:00
Andrew Casey 1bcb4910ca Thread typesMapLocation down to the ProjectService
Fixes #22607
2018-09-18 10:38:43 -07:00
Andrew Casey e2eda0a43f Substitute process ID for "PID" in log file names
This will help us solve the problem of logs getting clobbered when the
server restarts.
2018-08-23 17:56:29 -07:00
Andrew Casey daccc978a8 Don't compute suggestion diagnostics for lib files
The check applied to semantic diagnostics (and `checkSourceFile`) should
also apply to suggestion diagnostics.  Fixes assert.
2018-08-07 17:58:35 -07:00
Andrew Casey 250913ad09 Normalize paths in GetEditsForFileRename 2018-06-08 18:02:33 -07:00
Andrew Casey 2e0cc63067 Check TransformFlags.ContainsJsx, rather than LanguageVariant.JSX 2018-05-22 10:51:19 -07:00
Andrew Casey edd31a1505 Preserver jsx imports even when the compiler option is not set
...based on feedback from VS Code users.

Fixes #23287
2018-05-21 16:57:18 -07:00
Andrew Casey 8f662a9131 Extract sorting helper 2018-05-18 12:53:28 -07:00
Andrew Casey 43e1edf10a Eliminate runtime type check 2018-05-18 10:54:40 -07:00
Andrew Casey 7fcf1fdeb6 Delete redundant tests 2018-05-18 10:49:10 -07:00
Andrew Casey a327241655 Sort exports when organizeImports is run
Note that there's no attempt to remove unused exports.

Fixes #23640
2018-05-17 18:38:42 -07:00
Andrew Casey 0b89460c18 Don't collect open-file telemetry on the syntax server
It's throwing an exception (since there's no program from which to
retrieve the SourceFile) and there's no reason to fix it since the
same files are open in the semantic server.
2018-05-16 13:40:24 -07:00
Andrew Casey 543c5daf9c Ignore case when sorting imports 2018-05-10 18:10:05 -07:00
Andrew Casey 7281bb7510 Stop deleting empty named import lists
Fixes #23892
2018-05-10 18:01:55 -07:00
Andrew Casey 26c836b12a Propagage reportsUnnecessary in convertToDiagnosticsWithLinePosition 2018-04-17 19:44:52 -07:00
Andrew Casey 855171bde5 Introduce a --syntaxOnly server mode
1. Disable the LS in all projects
 2. Don't create Program objects
 3. Ignore config files
2018-04-04 16:44:15 -07:00
Andrew Casey e37ff2574b Test suppression of diagnostic events 2018-03-22 16:44:12 -07:00
Andrew Casey 517cf6aa89 Add support for suppressing project events
VS doesn't consume (e.g.) `syntaxDiag` events, so there's no reason to
do the work to compute their payloads.
2018-03-22 16:44:09 -07:00
Andrew Casey 564183f9ed Fix lint errors 2018-03-21 15:18:06 -07:00
Andrew Casey 9352a8bc11 Delete IoSessionOptions
Many of the operations were unused because the values were being
accessed directly from the enclosing scope.
2018-03-21 14:56:06 -07:00
Andrew Casey 8ead7ab29c Organize imports within ambient module declarations 2018-02-22 16:30:57 -08:00
Andrew Casey 189eb505b9 Factor worker method out of ts.OrganizeImports.organizeImports 2018-02-22 16:30:56 -08:00
Andrew Casey 427e6ed3e6 Tidy isAmbientModule 2018-02-22 16:30:55 -08:00
Andrew Casey cc386d25a4 Filter FAR results to initial SourceFile 2018-02-20 14:35:01 -08:00
Andrew Casey fee1df34ce Implement ts.OrganizeImports.removeUnusedImports
TODO: Still need to add support for organizing imports in ambient
modules
2018-02-20 10:21:25 -08:00
Andrew Casey b64eefdb20 Remove redundant null check 2018-02-16 15:50:12 -08:00
Andrew Casey 1faefc7703 Use correct lowercase name 2018-02-16 14:51:31 -08:00
Andrew Casey 9c2b95dae3 Make FAR handle non-existent imported symbols 2018-02-16 14:49:23 -08:00
Andrew Casey 7a31394788 Group imports before sorting and coalescing 2018-02-16 13:15:07 -08:00
Andrew Casey 5c278cee17 Address PR feedback
Eliminate cancellation token

Add organizeImports.ts to tsconfig.json

Simplify ts.OrganizeImports.organizeImports

Simplify sortImports

Semantic change: all invalid module specifiers are now considered to be
equal.

Simplify comparisons using ||

Pull out imports with invalid modules specifiers

...for separate processing.  They are tacked on to the end of the
organized imports in their original order.

Bonus: downstream functions can now assume imports have valid module
specifiers.

Rename baseline folder with leading lowercase

Simplify coalesceImports

Remove some unnecessary null checks

Simplify baseline generation
2018-02-16 10:56:16 -08:00
Andrew Casey f4141ac6bf Separate OrganizeImports into its own namespace and file 2018-02-16 10:52:29 -08:00
Andrew Casey 979b14689e Fix lint errors 2018-02-16 10:52:21 -08:00
Andrew Casey 5656f35b6a Introduce an organizeImports command
In phase 1, it coalesces imports from the same module and sorts the
results, but does not remove unused imports.

Some trivia is lost during coalescing, but none should be duplicated.
2018-02-16 10:51:38 -08:00