* 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 undefined to Symbol.declarations' type
Symbol.declarations now has type `Declaration[] | undefined`.
I made a mistake somewhere in the checker related to JS checking, so
there are quite a few test failures right now.
* undo clever change to getDeclaringConstructor
* Address PR comments
1. More early-returns.
2. More line breaks.
* 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
* Create symlink cache when a pnpm module is found
* Keep pnpm-internal symlinks out of the symlink cache
* Filter out pnpm path from realpath module specifier too
* Use ignoredPaths instead of pnpm-specific path
* Test that forceConsistentCasingInFileNames does not apply to Windows drive roots
* Add file symlink baselines
* Add directory symlink baselines
* Update test to retain its meaning
Its purpose is (apparently) to demonstrate that
forceConsistenCasingInFileNames can interact badly with synthesized
react imports. Since the casing of the synthesized import has changed,
also modify the casing of the explicit reference to still conflict.
* Make VFSWithWatch.realpath use the path on disk
* Update VFS realpathSync to behave like realpathSync.native
* Use fs.realpathSync.native when available
In local measurements of an Office project, we saw initial project
loading get 5% faster on Windows and 13% faster on Linux. The only
identified behavioral change is that it restores the case used on disk,
whereas realpathSync retains the input lowercase.
* Rename SortedMap.getKeyAndValue to getEntry
* 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
* --explainFiles currently hardcoded
* Move configFileSpecs to configFile so it can be used in program later
* Explain root file inclusion reason and explain include files in the log
* Baseline explainFiles
* Fix incorrectly reporting of file list two times in --b mode
* Fix unnecessary new lines in output represented incorretly in the baseline
* More tests
* More cleaning up
* Keep listing files in same order as list files, just add explaination
* Fix double listing of file names when the program has errors
* Make diagnostic chains for file include reason
* Add explaination for the file include to diagnostics for program
* Harness ls incorrectly adding tsconfig as the root file
* Fix incorrect use of path for calculating absolute path
* Fix the root file in fourslash
* Test project service options merge
* Add config file name to matched by include explaination
* Add test for when the file changes and program is reused completely but related file information is reattached to correct location
* Handle file preprocessing diagnostics updates when program is reused and related information location changes
* Moved types to types.ts
* Refactoring and cleanup
* More cleanup
* More refatoring
* Handle synthetic imports
* Baselines after merge
* Parse excludeDirectories and excludeFiles
* Use watch factory in typings installer
* Some refactoring for watchFactory
* Create Noop watcher if file or directory being watched is excluded
* Baselines without using exclude watch options
* Baselines including exclude option
* Handle exclude options in the system watches
* Add test without exclude option for recursive directory watching
* Test baselines with exclude option
* Always set sysLog
* Test for exclude option in server
* Add exclude options in the config file and fix the test
* Fix host configuration for server
* Handle host configuration for watch options
* Fix sysLog time log so baselines can be clean
* Handle reloadProjects to reload the project from scratch
* Ensure that file updates are reflected
* Feedback
* Feedback
* Adds support for declaring the bundled name of a dts module export
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Adds baselines
* Update the tests
* Try to reduce the scope of the bundledPackageName error
* Use the flag in more baselines
* Get it green
* More tests
* Handle more feedback
* More test cleanup
* Set the moduleResolution for the tsconfigs
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Passing --checkJs always sets --allowJS
Even if you have `"allowJs": false`. This is not a useful combination.
Changing this makes the compiler more friendly and easier to describe.
* only set allowjs if not explicitly set
* remove stray newline
* restore bad config error
* use an accessor function instead
* Modify test harness so it can report underlying issue, fix small parent pointer issue
* Fix underlying export asignment check issue and fix lints
* Ensure class/function duplicate declaration errors are reported regarless of which is encountered first
* Ensure flag conflict errors are reported regardless of which declaration is encountered first
* 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>
* Fix find-all-references on `undefined`
* Show references in input files in baseline
* Inline commentEachLine
* firstOrUndefined doesn’t take undefined
* Add full implemention of Map and Set to shims
* Update default Map interface
* Remove WeakMap/WeakSet
* Add tests for set shim
* Update most usages of Map<K, true> to Set
* PR Feedback
* Fix lint issues
* Change key in fsWatchCallback
* Simpler shim, more tests
* Fix typo in collection shim
* Start experiment
* Add logging
* Go back to a single program
* Fix forEachExternalModuleToImportFrom
* Move auxiliary program to language service
* Add logging
* Don’t use resolution cache
* Fix(?) containingProjects for ScriptInfo in auxiliary program
* Fix ScriptInfo project inclusion
* Add test for default project of auto-importable ScriptInfo
* Add fourslash server test
* Don’t create auto import provider inside node_modules
* Add monorepo-like test
* WIP
* Naively ensure autoImportProvider is up to date after package.json change
* Start limiting when auto update provider gets updated
* Respond to changes in node_modules
* Don’t create auto-import provider until a file is open that would use it
e.g., don’t create them during cross-project find-all-refs
* Clean up naming, @internal marking, and fix empty project creation bug
* Drop devDependencies, include peerDependencies
* Add additional compiler options
* Fix interaction with importSuggestionsCache
* Move option to UserPreferences, allow inclusion of devDependencies
* Don’t filter out peerDependencies
* Watch unparseable package.jsons
* But don’t filter packages out due to an invalid package.json
* Update test
* Don’t use autoImportProvider in codefixes where it can never be used (or any refactors)
* Add CompletionEntry property for telemetry
* Add assertion for isPackageJsonImport to fourslash
* Fix missing pushSymbol argument
* Add isPackageJsonImport to tests and API baselines
* Fix unit test
* Host auto import provider in new Project kind
* Fix InferredProject attaching on AutoImportProvider-included files, load eagerly
* Update Public APIs
* Simplify PackageJsonCache host
* Remove unneeded markAsDirty
* Defer project finished event until after AutoImportProvider is created
* Make AutoImportProviderProject always report isOrphan = true
* Close and remove AutoImportProviderProject when host project closes
* Don’t set pendingEnsureProjectForOpenFiles
* Use hasAddedOrRemovedFiles instead of hasNewProgram
* Use host-wide watchOptions for package.json watching
* Add to `printProjects`
* Clean up
* Get autoImportProvider directly from LanguageServiceHost
* Clean up
* Clean up
* Close auto import provider on disableLanguageService
* Move AutoImportProvider preload to project updateGraph
* Clear auto import suggestion cache when provider program changes
* Fix tests
* Revert yet-unneeded change
* Use projectService host for module resolution host
* Don’t re-resolve type directives if nothing has changed
* Update src/server/project.ts
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Use ts.emptyArray
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Add deprecated related feature
* Add more support
* fix navtree
* Add identifier check
* Add more deprecated
* fix crash
* fix more crash
* fix crash
* improve diagnostic
* avoid new tag
* avoid tags
* accept baseline
* Check deprecated in binder
* fix baseline
* fix jsdoc cache
* fix incorrect fix
* Avoid useless changes
* Accept baseline
* Add tests
* fix perf
* fix public api
* Adjust deprecated mark on qualifed name
* Revolve alias symbol
* Use modifier flags insted of symbol props
* Fix modifier flag resolve
* Make lint happy
* Fix crash
* fix crash
* Add cached utils function
* Accept baseline
* Add more tests
* try pinning octokit again
* Avoid tests
* Use utils some
* Deprecated perf test (#3)
* check valueDeclaration only
* check without modifierFlags
* donot check alias
* use cached tag
* remove call to jsdoc
* use deprecated tag
* revert changes
* Revert mission changes
* use node flags
* cache result
* cache
* avoid modifier flags
* Opts
* fix jsdoc include modifier
* fix tests
* fix again
* use symbol flag
* set @octokit/rest back to latest
* fix trailing spacel int
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* use canonical file name when resolve module
* renameSync in vfs supports same folder.
* Update src/harness/vfsUtil.ts
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* change tss rather than compiler.
* remove useless comment.
* use fileName rather than path.
Co-authored-by: Song Gao <song.gao@laserfiche.com>
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* Refactor node factory API, use node factory in parser
* Move UnparsedSource nodes to factory
* Make most Node properties read-only
* Make pos/end/parent and JSDoc 'comment' read-only
* Update function/constructor-type factories
* Remove treeStateObserver
* Simplify Debug.deprecate
* Remove unused factory methods, simplify lazy factory methods
* Fix base factory used for source file updates
* Update test baseline due to merge from master
* Rename factory methods to be more consistent (#39058)
* Ensure formatter can always get a newline character
* Make FormatContext.host optional since it’s not necessary if format options are all applied
* Make FormattingHost required again
* Special-case window, self, global, globalThis methods
* Disambiguate global and this property completions in details requests
* Hide the Map<boolean> implementation
* Update old tests
* Replace SymbolOriginKind stringification with dedicated enum
* Sort the arrays of fileNames in the build info
Earlier we did this in testing to ensure we could baseline now moved to actual build info writing
Fixes#37156
* Sort using compareStringsCaseSensitive
* Allow emitter to write multiple newlines in node lists
* Progress
* Progress
* Fix recomputeIndentation
* Add tests, fix leading line terminator count
* Do a bit less work when `preserveNewlines` is off
* Fix accidental find/replace rename
* Restore some monomorphism
* Fix single line writer
* Fix other writers
* Revert "Fix other writers"
This reverts commit 21b0cb8f3b.
* Revert "Fix single line writer"
This reverts commit e535e279f9.
* Revert "Restore some monomorphism"
This reverts commit e3ef42743a.
* Add equal position optimization to getLinesBetweenRangeEndAndRangeStart
* Add one more test
* Actually save the test file
* Rename preserveNewlines to preserveSourceNewlines
* Make ignoreSourceNewlines internal
* Optimize lines-between functions
* Add comment;
* Fix trailing line terminator count bug for function parameters
* Preserve newlines around parenthesized expressions
* Back to speculative microoptimizations, yay
* Don’t call getEffectiveLines during tsc emit at all
* Convert symlink scenarios to virtual FS where its symlinks are correctly maintained
Adds test for #36866
* Fix the casing issue when redirects differ in casing of the file
* Make ModuleSpecifierResolutionHost internal
* Refactoring for ModuleSpecifierResolutionHost
* If any of the file path option is from node_modules folder, consider only paths in node_modules folder
* Update src/services/utilities.ts
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* Add tests that fail because of symlink to non common directory node_modules
* When the imported module is through node_modules and symlink to folder that isnt node_modules
Most of the monorepo like scenarios are like this so looking at symlink to decide if file can be imported is essential
Fixes#28689
* Adds some docs to the LSP dts
* Ensure that getProgramDiagnostic is included everywhere that getCompilerOptionsDiagnostic is
* Update baselines
* Apply suggestions from code review
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
* Remove the getCompilerOptionsDiagnostics -> getProgramDiagnostics change
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* Make the systems for baselining default to pretty
* Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state
This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes#37269
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect
* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes#36748
* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands
* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge
* Update src/server/project.ts
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Make clearSourceMapperCache required
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Adds floating block comments to the outlining spans response
* Only use one route for grabbing outline nodes, which now includes special casing the EOF token
* Allow 'find references' to work on most declaration keywords
* Add support for rename
* Add more keywords, move logic out of checker and into services
* Add additional type and expression keywords
* Add test case to verify directory casing preservation when watching
* Fix unicode file name handling when watching failed lookup locations
* Add special file name lower conversion routine and use that instead of toLowerCase
Fixes#31819 and #35559
* Remove unicode from code
* Replace toLocaleLowerCase on filenames with ts.toFileNameLowerCase
* Make the intent of using toFileNameLowerCase more clear and why we make the restriction on turkish I with dot on top of it
* Update baselines for newly added tests in master
* WIP
* Test no longer crashes, but emit trampoline is incomplete and skips pipeline phases
* Fix lints, use non-generator trampoline in emit (still skips pipeline)
* Final version with emitBinaryExprssion work stack that is only used if possible
* Fix lints
* retarget to es2015 for testing
* Use bespoke state machine trampolines in binder and checker
* Remove now extraneous code in parser
* Adjust fixupParentReferences to use a depth first preorder traversal rather than breadth first
* Reintroduce incremental fast bail in fixupParentReferences
* Revert target to es5
* PR feedback
* Small edit for devops rebuild with updated definition
* Fix comment nits, add internally extraneous check back into transformer
* Adds support for showing default exports in the navtree - Fixes#34601
* Handle the feedback in #35477
* Navigation items using default export or export = will get noted if they are a const vs function
* Add test that demonstrates npm install watch behaviour some times
* Use watch invoked with `node_modules/.staging` as watch for refreshing complete node_modules, so that npm install is reflected correctly
Fixes#35966