* Initial support for module: node12
* Add allowJs and declaration emit enabled tests
* Fix typos
* cts, mts, cjs, mjs, etc extension support
* Fix watch of files whose intepretation changes due to a package.json update
* Minor PR feedback
* Adjust error message
* Initial import/export/self-name support
* Accept new error codes
* TypesVersions support in export/import map conditions
* Fix import suggestion and autoimport default extensions under new resolution modes
* Add tests for import maps non-relative name lookup feature
* Fix isDeclarationFileName for .d.mts and .d.cts
* Preserve new extensions when generating module specifiers
* Fix spurious implict any suggestion caused by file ordering bug and optimize import name format detection by relying on parents being set
* Fix a bunch of incremental bugs that dont repro under fourslash for some reason
* Accept updated baseline
* Always include extensions on completions for cjs/mjs style imports
* String completion relative import suggestions respect the mode of the import when choosing if they provide extensions
* Style feedback
* Change diagnostic case
* Make isDefinition aware of target symbol
Initial code, haven't fixed any tests yet.
* Update baselines
This commit includes a regression for commonjs aliases:
```js
// @filename: a.js
function f() { }
module.exports.f = f
// @filename: b.js
const { f } = require('./a')
f/**/
```
Now says that `f` in b.js has 1 reference --
the alias `module.exports.f = f`. This is not correct (or not exactly
correct), but correctly fixing will involve re-creating the ad-hoc
commonjs alias resolution code from the checker. I don't think it's
worth it for an edge case like this.
* update more unit tests
* Fix symbol lookup for constructors
* More baselines + two fixes
1. Fix `default` support.
2. Add a secondary declaration location for commonjs assignment
declarations.
* Update rest of baselines
* Switch a few more tests over to baselines
* Fix getChildCount/At methods in EndOfFileTokens
Before, they were hardcoded to return `0` and `undefined!`, respectively, but that is inaccurate for `EndOfFileToken`s with attached jsdoc.
* Add tests for getChild* methods on EndOfFileTokens
* Initial work to support syntactic diagnostics in partial mode.
* Test out 'syntacticDiagnosticsSync' requests.
* Added a 'geterr' test.
* Accepted baselines.
* Remove/clean up comments.
* Enable module specifiers for all auto imports
* Use isIncomplete
* isIncomplete continuation
* Lots of fixes
* Merged/transient symbol fixes, resolve all ambient module specifiers up front, pull as many as we want from cache
* Fix existing tests
* Start testing
* Add more tests
* Set cache attempt limit, update API baseline
* Fix a few tests
* Fix contextToken
* Split getModuleSpecifiers
* Unexport function
* Clean up importFixes
* Clean up completions
* Delete transient symbol assertion - fixing later
* Add signature arguments label support
* Support rest parameters and destruction
* make lint
* Fix tuple rest parameters
* Adjust name styles
* Rename to inline hints
* Partition inline hints
* Adjust range pred
* Add function expression like hints
* Support configure inline hints
* Display hints in single line
* Add test suits and tests
* Add range tests
* Support more hints
* Add more options
* Fix logical
* Add more cases
* Support call chains
* Rename options
* Match lastest protocol
* Update protocol changes
* Support context value and hover message
* Revert "Support context value and hover message"
This reverts commit 37a7089633.
* Revert "Update protocol changes"
This reverts commit e5ca31bc30.
* Add hover message
* Accept baseline
* Update src/services/inlineHints.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Update src/services/inlineHints.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Cache across the program
* Fix possible undefined
* Update protocol changes
* Fix missing property
* Make lint happy
* Avoid call chain hints
* I'm bad
* Add whitespace before type
* Add more tests
* Should care about jsdoc
* Support complex rest parameter
* Avoid module symbol hints
* Care about leading comments
* Fix CR issues
* Avoid changes
* Simplify comments contains
* Fix CR issues
* Accept baseline
* Check parameter name before create regex
* Rename option
* Avoid makers
* Skip parens for argument
* Fix CR issues
* Fix enums
* Accept baseline
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Switches from never allowing semantic highlight on JS to only doing it if we have a valid source file
* Adds a way to test and validate that an arbitrary JS file gets semantic classification results
* Revert to just dropping the if statement
* 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>
* 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
* 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
* 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
* 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
Previously, when getting jsdoc for signatures, the services layer would
get the jsdoc tags for the base symbol of a signature if it was
present. This is fine except when the base was overloaded. In that case,
the multiple signatures of the overload would all contribute jsdoc,
which is not correct.
A more correct fix would be to resolve overloads to the base, but
the compiler doesn't have this capability and adding it or jury-rigging
it seems like it would be complex, inappropriate for a fix to ship in a
patch version.
Co-authored-by: Orta Therox <git@orta.io>
Co-authored-by: Orta Therox <git@orta.io>
* Support go-to-definition for imports of scripts and arbitrary files
* Support go-to-definition for non-existent files
* Add missing file property
* Use `isExternalModuleNameRelative` instead of `!pathIsBareSpecifier`
* Add partial semantic test
* Combine with symbol search for non-source-file file references
* Fix and accept API baselines
* Fix useless or
* A definition is unverified if the file path was a guess, even if a source file has that path
* Add 'data' property to completion entry for better cooperation between completions and completion details
* Add doc comment
* Update API baselines
* Add server test
* Test session’s Full result
* Fix tests
* stableSort to fix server fourslash test
* Explicit verification of data parameter
Make `tracing` either `undefined` or the same namespace as before.
Switching all calls to `tracing?.___` means that there is no cost for
a call or the arguments when tracing is not used. Comparing two runs
without tracing (27 runs, drop 5+5, avg rest) I get:
master:
42.59s user 1.00s system 165% cpu 26.372 total
changed:
42.01s user 0.982 system 165% cpu 26.039 total
(Makes it all private, so no api changes.)
* Naive implementation enough to build and write a test
* Add simple test
* Add project references test
* Add deduplication test, accept baselines
* Add test for referencing a script (doesn’t do anything)
* Update API baselines
* Use refFileMap for non-module references
* Fix find-all-refs on module specifier
* Remove unused util
* Don’t store text range on ts.RefFile
* Ensure string literal could itself be a file reference
* Remove unused utilities
* Improve baseline format
* Preserve old behavior of falling back to string literal references
* Update baselines from master
* Fix old RefFileMap code after merge
* Add test for additional response info
* Undo test change
* Add tracing support to tsserver
Read the `TSS_TRACE` environment variable to determine which directory
trace files should be written to.
Notable changes from tsc tracing:
1) Drop all tracepoints that depend on type IDs
2) Write output to trace.PID.json
3) New, server-specific events (request/response, cancellation, etc)
* Drop try-finally blocks that aren't strictly necessary
* Fix lint error
* Trace background work (for diagnostics)
* Move try-finally blocks into session so tsc doesn't use them
* Add missing try-finally
* Use consistent capitalization
* Inline canPop call where underlying variable is available
* Clarify comments
* Include PID in build-mode file names
* Introduce more efficient popAll function
* Trace throwIfCancellationRequested rather than isCancellationRequested
* Remove unnecessary try-finally blocks
* Add a command-line argument for consistency with logging
* Fix rebase issues
* Address PR feedback
* Rename completionEvents to eventStack
* Drop assertStackEmpty as hard-to-maintain and marginally valuable
* Rename stepCancellation to stepCanceledEarly
* Rename stepEarlyCancellation to stepCanceled and use flag instead
* Check correct variable on exit
* Add separate flag serverMode for server mode to allow back compatibility
* Addressed code review feedback.
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Hack everything together
* Add test
* Remove realpath from program
* Ensure symlinked directories are directories
* Revert unnecessary change
* Update baselines
* Use host program realpath on AutoImportProviderProject files before program creation
* Which fixes hasRoots() too
* Apply suggestions from code review
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Lint
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Resolve only relative references in open files on syntax server
* Support resolving tripleslash references only in the open file
* 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>