Commit graph

409 commits

Author SHA1 Message Date
Sheetal Nandi a76a16696d
Move useSourceOfProjectReferenceRedirect to program so other hosts can use it too, enabling it for WatchHost (#37370) 2020-03-12 13:11:11 -07:00
Sheetal Nandi 243186685b
Increase the idle time before which ensureProject for open file is called (#37121)
* Increase timeout for ensuring projects for open files

* Condense the project/file printing in the log (given now we have project printed anytime its structure changes)
2020-03-11 16:47:11 -07:00
Sheetal Nandi e89df5ce6f
Handle getScriptVersion correctly to ensure program structure is checked correctly (#36808)
* 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>
2020-02-25 16:11:21 -08:00
Ron Buckton 177713ef45
Switch Debug.assertX functions to use asserts conditions (#36995)
* Switch Debug.assertX functions to use asserts conditions

* Replace assert functions with ts.noop when assertion level too low
2020-02-24 18:20:58 -08:00
Nathan Shively-Sanders d76380419d
Fix typo in getChangesSinceVersion (#36885) 2020-02-20 08:30:22 -08:00
Hye Sung Jung 8ed129771f
fix spelling errors (#36523)
* fix spelling errors

* remove changes in lib/*
2020-01-30 13:39:54 -08:00
Ben Lichtman e479a9f679 Respond to CR 2020-01-24 16:23:54 -08:00
Ben Lichtman f047111c64 Track changes to redirect info 2020-01-24 15:15:05 -08:00
Ben Lichtman c9c3792747 Produce redirect info about files when requested 2020-01-23 12:32:36 -08:00
Andrew Casey 071819bb37
Report time spent in updateGraph (#35675)
Add a response property indicating how much of the elapsed time (from
`onMessage` to `doOutput`) was spent in `updateGraph` calls.  If there's
no `updateGraph` call, the property is undefined, to save space (with
the downside that it's harder to tell whether a given telemetry event
could have had the property).

Fixes #34774
2020-01-08 14:41:34 -08:00
Sheetal Nandi 236012e47b
Add watchOptions to tsconfig and allow supplying them on command line as well (#35615)
* Create different watch options in compiler options

* Thread through the new watch options

* Actually use the options passed through for watch strategy

* Support delay on updating child directory watches

* Make watchOptions separate from compilerOptions

* Support passing watch options from command line

* Handle displaying of watchOptions
2019-12-11 13:26:44 -08:00
Sheetal Nandi 4212484ae1
Open bigger set of configured projects when opening composite project for operations that operate over multiple projects like rename (#33287)
* Add isInferredProject, isConfiguredProject and isExternalProject

* Skip refreshing configured project on change of config file if its not loaded

* Open a tree of projects when doing findAllRefs or rename operations

* Fix addToSeen project key

* Refactor combineProjectsOutputWorker

* if the definition is local, no need to load and look in other projects

* Add disableSearchSolution as option to disable looking for solution

* Rename the option to disableSolutionSearching
2019-12-11 12:28:18 -08:00
Sheetal Nandi 07364595e4
Handle consistent file name during editor and tsc --watch scenarios (#34622)
* Add isInferredProject, isConfiguredProject and isExternalProject

* Add test for rename on file with case change that fails
Test for #25460

* Dont store fileName on text storage

* Store root file names in the root file map to reflect their name

* Delay open file triggering watches

* Correct the name of source file as we query it (eg. it could be same source file returned in old program with different casing on case insensitive file name)

* More tests

* Refactoring

* Cache bind And check diagnostics and always get program diagnostics from the program

* Another test

* Try to report conflicting file error on file instead of global diagnostics

* Create better tests for module resolution diagnostics check

* Fix lint errors
2019-12-10 18:25:10 -08:00
Sheetal Nandi 25ec62f892
Handle when output file would be in subFolder specified by outDir/declarationDir (#35366)
Fixes #35328
2019-11-27 09:36:52 -08:00
Sheetal Nandi 47ec514cf4
Use empty object for invalid package json contents instead of undefined (#34906)
* Use empty object for invalid package json contents instead of undefined
Fixes #34726

* Behave as if package json doesnt exist in case of invalid json in package json
2019-11-04 14:31:45 -08:00
Sheetal Nandi dbef230eb8
This handles when packages are symbol links in mono repo like scenarios to use source files instead of output d.ts from project reference (#34743)
* Fix incorrect outDir usage instead of out

* Handle symlinks of packages in mono repo like packages
Fixes #34723

* Added clarified comment
2019-10-29 10:49:14 -07:00
Keen Yee Liau f689982c9f Prioritize loading plugin from probeLocations over peer node_modules
This commit reoroders the loading sequence of a tsserver plugin. It
should first check `pluginProbeLocations` before checking peer
node_modules.

PR closes https://github.com/microsoft/TypeScript/issues/34616
2019-10-23 11:28:44 -07:00
Andrew Branch 454a3a0b0f
Fix auto-imports from auto type acquisition definitions (#33766)
* Fix auto-imports from ATA typings

* Compare canonical filenames in isImportablePath
2019-10-17 13:59:09 -07:00
Andrew Branch 304fcee09b
Updated: Only auto-import from package.json (#32517)
* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports

* Don’t fail when alias isn’t found

* Make some easy optimizations

* Clean up memoization when done

* Remove unnecessary semicolon

* Make getSymbolsFromOtherSourceFileExports pure

* Cache auto imports

* Revert "Cache auto imports"

This reverts commit 8ea4829587.

* Handle merged symbols through cache

* Be safer with symbol declarations, add logging

* Improve cache invalidation for imports and exports

* Check symbol presence first

* Only run cache invalidation logic if there’s something to clear

* Consolidate cache invalidation logic

* Fix reuseProgramStructure test

* Add more logging

* Only clear cache if symbols are different

* Refactor ambient module handling

* Start caching package.json stuff

* Support package.json searching in fourslash

* Move import suggestions cache to Project

* Start making more module specifier work available without having the importing file

* Going to backtrack some from here

* Get rid of dumb cache, fix node core modules stuff

* Start determining changes to a file have invalidated its own auto imports

* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports

* Don’t fail when alias isn’t found

* Make some easy optimizations

* Clean up memoization when done

* Remove unnecessary semicolon

* Make getSymbolsFromOtherSourceFileExports pure

* Cache auto imports

* Revert "Cache auto imports"

This reverts commit 8ea4829587.

* Handle merged symbols through cache

* Be safer with symbol declarations, add logging

* Improve cache invalidation for imports and exports

* Check symbol presence first

* Only run cache invalidation logic if there’s something to clear

* Consolidate cache invalidation logic

* Fix reuseProgramStructure test

* Add more logging

* Only clear cache if symbols are different

* Refactor ambient module handling

* Finish(?) sourceFileHasChangedOwnImportSuggestions

* Make package.json info model better

* Fix misplaced paren

* Use file structure cache for package.json detection when possible

* Revert unnecessary changes in moduleSpecifiers

* Revert more unnecessary changes

* Don’t watch package.jsons inside node_modules, fix tests

* Work around declaration emit bug

* Sync submodules?

* Delete unused type

* Add server cache tests

* Fix server fourslash editing

* Fix packageJsonInfo tests

* Add node core modules cache test and fix more fourslash

* Clean up symlink caching

* Improve logging

* Function name doesn’t make any sense anymore

* Move symlinks cache to host

* Fix markFileAsDirty from ScriptInfo

* Mark new Project members internal

* Use Path instead of fileName

* Rename AutoImportSuggestionsCache

* Improve WatchType description

* Remove entries() from packageJsonCache

* Fix path/fileName bug

* Also cache symlinks on Program for benefit of d.ts emit

* Let language service use Program’s symlink cache
2019-09-27 13:38:31 -07:00
Sheetal Nandi 432da939c1 Add doc comments for fileExists and directoryExists implementation 2019-09-23 13:54:12 -07:00
Sheetal Nandi b26ca160f4 Merge branch 'master' into referencesPrototypeSourceFile 2019-09-11 12:27:58 -07:00
Sheetal Nandi 4c4ddf833d Merge branch 'master' into referencesPrototypeSourceFile 2019-08-21 15:42:36 -07:00
Alexander T b728bf4bfa Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-14 13:42:02 +03:00
Sheetal Nandi e10991413c Print program only if there are files are added or removed from the program. 2019-08-12 13:18:16 -07:00
Alexander ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Alexander 481d70d50d Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-07 21:23:10 +03:00
Andrew Casey 01e1b1bb27
Merge pull request #32612 from mrcrane/etw-logger
Use optional module "@microsoft/typescript-etw" for ETW logging
2019-08-06 12:44:48 -07:00
Alexander a292ae1789 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-04 15:35:41 +03:00
Michael Crane cca32f079c Remove more try-finally blocks 2019-08-02 16:49:50 -07:00
Michael Crane fa3e9c86db Add PerfLogger and NullLogger to simplify conditional logic 2019-08-01 12:46:33 -07:00
Orta Therox 777d504580 Fix a typo in the error message around language service plugins 2019-08-01 12:12:26 -04:00
Bill Ticehurst 996e7e50d5 Use optional module "@microsoft/typescript-etw" for ETW logging 2019-07-29 15:32:40 -07:00
Alexander 0059763d8f move eslint rules from eslint-plugin-microsoft-typescript to scripts/eslint 2019-07-24 13:31:17 +03:00
Sheetal Nandi b631850978 Add option disableSourceOfProjectReferenceRedirect to disable using sources of project reference redirect from editor 2019-07-10 15:49:53 -07:00
Sheetal Nandi 824c22c460 Source of project reference behave as if those files cannot be emitted. 2019-07-09 14:52:27 -07:00
Alexander T 9f474150c6 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-02 17:57:44 +03:00
Sheetal Nandi f7ea0bab60 Refactoring 2019-07-01 14:33:39 -07:00
Sheetal Nandi 4d13f53df8 Merge branch 'master' into referencesPrototypeSourceFile 2019-07-01 11:50:11 -07:00
Sheetal Nandi f72af3be60 Verify the scenarios when d.ts directory of dependency doesnt exist 2019-07-01 11:34:57 -07:00
Sheetal Nandi 4ae091fa9e
Update src/server/project.ts
Co-Authored-By: Orta <orta.therox+github@gmail.com>
2019-06-28 10:17:58 -07:00
Sheetal Nandi da9260c013 Create original project when location is in source of project reference redirect 2019-06-27 10:38:52 -07:00
Sheetal Nandi f4728682b7 Watch generated file if it doesnt exist when trying to translate it to to source generated position 2019-06-25 15:16:11 -07:00
Sheetal Nandi 3e49556a88 Watch generated file if it doesnt exist when trying to translate it to to source generated position 2019-06-25 15:11:44 -07:00
Alexander 7389200ce2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-06-23 18:49:35 +03:00
Sheetal Nandi ecf875112b Check for language serivice enabled when including source files 2019-06-21 14:24:25 -07:00
Sheetal Nandi 0adab8934a Use source files instead of .d.ts files from project references 2019-06-21 13:14:28 -07:00
Wesley Wigham 37b20f6afd
Eliminate references to defunct LSHost in comments (#32018) 2019-06-20 19:11:46 -07:00
Alexander T 9fcaa19ab0 microsoft-typescript/no-in-operator 2019-06-20 14:13:46 +03:00
Sheetal Nandi 2fd80b3142 When resolving from typings cache, handle node code modules
Fixes #29865
2019-06-07 16:21:39 -07:00
Benjamin Lichtman 8c443b1481 Stop invalidating resolution when file stays open 2019-05-30 15:05:53 -07:00