* Pass absolute path to directoryExists
As pointed out by @gretzkiy, the `directoryExists` call added to
`matchFiles` in #44710 should have been passing the absolute path (since
the current directory might not match `currentDirectory`).
* Add test, simplify/clarify/fix matchFiles and friends
Co-authored-by: Andrew Branch <andrew@wheream.io>
* Ensure symbol key unique when target is a local symbol exported elsewhere
* Add test
* Support targets without declarations
* Best key yet
* A-ha moment
* Clean up types
* Update API
* Update unit test
* Parse type-only import specifiers
* Add type-only export specifiers
* Update transform and emit
* Update checking
* Fix elision when combined with importsNotUsedAsValues=preserve
* Accept baselines
* Add test
* WIP auto imports updates
* First auto-imports test working
* More auto-import tests
* Fix auto imports of type-only exports
* Add test for promoting type-only import
* Sort import/export specifiers by type-onlyness
* Update completions for `import { type |`
* Update other completions tests
* Respect organize imports sorting when promoting type-only to regular while adding a specifier
* Fix comment mistakes
* Update src/services/codefixes/importFixes.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Rearrange some order of assignments in parser
* Split huge if statement
* Remove redundant check
* Update new transformer
* Fix import statement completions
* Fix type keyword completions good grief
* Fix last tests
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* 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
* Add support for raising if you set a tsconfig entry of target/module with the right setting in the root
* Switch to check for any compiler option in the root which doesn't include compilerOptions
* Get green
* Apply suggestions from code review
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* Update src/compiler/commandLineParser.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Minor fixes to convertToAsync
* Back out on nested return in inner continuation
* Baseline update
* Verify type argument for call can be used, add a few more early exit shortcuts
* Make getSourceOfProjectReferenceRedirect take a Path
* Add useCaseSensitiveFileNames to ModuleResolutionHost
...so that path comparisons can use it during module resolution.
* Re-enable realpathSync.native for case-insensitive file systems
* Update tsc-instrumented for project build
loggedIO has a weird build that never got updated for the project build
system. This PR just adds a project for it in a straightforward way. It
might be less efficient than the old way, but that's not a big concern
for recording RWC test cases.
However, I may have done things wrong. If anybody knows
tsc-instrumented, please comment.
* Create a second loggedIO tsconfig for tsc-instrumented
The normal tsconfig should not have `prepend`; the standalone one for
tsc-instrumented should.
* fix semicolon lint
* WIP on refining the new --help
* Fix types in the boolean trivial lint rule
* Update baselines
* More work
* Updates the color logic
* Simplifies the CLI color code
* Use cyan instead of blue for win powershell/command prompt
* Use bright white when blue is probably going to look off
* Fix NO_COLOR
* Adds a test to cover NO_COLOR
* Update src/compiler/diagnosticMessages.json
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Update compiler diagnostic text
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* 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.
* Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject
* Reuse previously computed values and refine comments
* Add baselines for test matrix
* Add some failing tests around transient symbols
* Working, but slower
* A class is much faster, apparently
* This is probably best?
* Back to multimap
* Go back to single symbol cache
* Revert now-unnecessary generics
* Rename and reorganize
* Fix weird compound condition
* Clean up
This is the line number side of ecddf8468f (from #21924, fixing #21818).
But the code is slightly improved for both cases: instead of testing
that `leaf` is defined, check whether `lineCount` is zero, and if it is,
return `〈1,0〉` for the one-based line and zero-based column numbers.
(The requirement of `lineCount > 0` is also seen in the fact
that `lineNumberToInfo` expects a "*One*BasedLine" argument.)
I've stared at this code way too much, since I think that there is
something more fundamentally wrong here. E.g., `EditWalker` only
`push`es to `startPath` but never pops even a `children`-less node that
is left after deleting the whole contents. But I can't figure out the
overall structure, which is also why the test that I added is not
great (see the comment there; also, #21924 is dealing with the same
problem and didn't add a test).
Fixes#44518.
* 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>
* add shape updates to baselines
* avoid computing a full shape for indirectly invalidated files
using file version as shape is enough to keep build info valid
and it's much cheaper
* Pass session into plugin
* Use unknown message type
* Add missing unknown
* use editor services insted of every project
* Fix baseline
* Add plugin test
* Avoid type parameter
* Accept baseline
* Make export-module and reference maps invertible
Right now, we're enumerating all the entries to find out which keys map
to a corresponding value. By maintaining a two-way map, we can convert
this linear search into a map lookup and skip allocation of many, many
iterator results.
* Fix lint error
* Add some explanatory comments
* Rename, drop type parameters, and add readonly variant
* Simplify member list
* Fold non-exporting behavior into custom map type
* Add cache invalidation for node_modules, config, and preferences changes
* Share watches with closed script info
* Update API baseline
* Small adjustments for fewer object allocations
* Document overloaded return value
* Update baselines
* Store isAutoImportable separately from modulePaths
* Add back missing return
* Return wrapped watcher instead of underlying one
* Make user preferences part of the cache key instead of implicitly clearing in editor services
* Fix missed merge conflict
* Fix discovery of more pnpm symlinks
* Add some tests
* Never show pnpm paths in auto imports, even if there’s no other path
* Import statement completions can return none
* Fix tests
* Add failing test showing poor symlink cache reuse
* Fix test, fails for right reasons now
* Preserve cache built up during program creation, then fill in with program resolutions
* Remove obsolete comment
* Remove obsolete type assertion
* Revert fully filtering out ignored paths