Commit graph

103 commits

Author SHA1 Message Date
Wesley Wigham
191f4f63ab
Explicitly add dependency on node to compiler tsconfig, remove es6+ string method usage (#39636) 2020-07-17 07:02:05 -07:00
Sheetal Nandi
667ba74c93
Resolve only relative references in open files on syntax server (#39476)
* 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>
2020-07-16 14:31:24 -07:00
Ron Buckton
9d5cd280ef Merge branch 'master' into migrateMapsAndSets
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/commandLineParser.ts
#	src/compiler/core.ts
#	src/compiler/moduleNameResolver.ts
#	src/compiler/transformers/declarations.ts
#	src/compiler/tsbuildPublic.ts
#	src/compiler/types.ts
#	src/compiler/utilities.ts
#	src/harness/client.ts
#	src/server/editorServices.ts
#	src/server/typingsCache.ts
#	src/server/utilities.ts
#	src/services/codefixes/convertToAsyncFunction.ts
#	src/services/documentRegistry.ts
#	src/services/importTracker.ts
#	src/services/refactorProvider.ts
#	src/services/refactors/extractSymbol.ts
#	src/testRunner/unittests/programApi.ts
#	src/typingsInstallerCore/typingsInstaller.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2020-07-07 13:53:46 -07:00
Ron Buckton
7b942b4fa8
Revert the type change to ts.Map (#39366) 2020-07-01 17:00:26 -07:00
Ron Buckton
611b77f2e6 Migrate more places to use Map/Set 2020-06-26 10:15:53 -07:00
Ron Buckton
eb2f4e2337
Switch to ES Map/Set internally (#33771)
* 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
2020-06-26 10:12:47 -07:00
Sheetal Nandi
a72ed0a2f5
Schedule failed lookup updates (#38560)
* Schedule failed lookup updates

* Tests
2020-06-09 12:00:37 -07:00
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
1a9c8197ff
Optimize module resolution cache for watch and editor (#37055)
* Refactor resolveName

* Have resolutions of failed lookups as array and resolved to fileName map
2020-03-11 14:35:26 -07:00
Andrew Casey
dd6811fbe3
Stop looking for the default configured project at node_modules (#35011)
* Optionally stop looking for the default configured project at
node_modules

* Make stopping at node_modules non-optional

* Generalize and simplify the change - node_modules files don't have default configured projects
2020-03-02 16:52:03 -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
Wesley Wigham
5144330c98
Fix implicit dependencies on es6 lib exposed by node changes 2020-02-19 16:43:40 -08:00
Sheetal Nandi
80ad0de87e
Fixes to handle file names in module resolution watching and createGetCanonicalFileName (#36106)
* 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
2020-01-31 10:40:57 -08:00
Sheetal Nandi
76ee0214f9
Use watch invoked with node_modules/.staging as watch for refreshing complete node_modules, so that npm install is reflected correctly (#36039)
* 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
2020-01-10 14:58:01 -08:00
Sheetal Nandi
1a614a27d1 Fix issue when types installed after watch/editor is opened for auto type reference that is for global types not being detected
Fixes #32285
2019-09-30 09:58:33 -07:00
Alexander T
0d941d6943 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-21 10:02:57 +03:00
Sheetal Nandi
5ac450510a
Handle network style paths for watching (#32888)
* Refactoring

* take windows style root as test server host parameter

* Handle network style paths for watching
Fixes #32796
2019-08-20 10:52:56 -07:00
Alexander
ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Alexander T
769bb0b475 remove tslint configuration 2019-06-27 13:49:35 +03:00
Sheetal Nandi
a0d164f142
Merge pull request #31820 from microsoft/nodeModules
When resolving from typings cache, handle node code modules
2019-06-12 10:55:26 -07:00
Sheetal Nandi
2fd80b3142 When resolving from typings cache, handle node code modules
Fixes #29865
2019-06-07 16:21:39 -07:00
Sheetal Nandi
a6c72a0cf3 Do not watch tsconfig files from folders that we canot watch
Fixes #30818
2019-06-07 12:10:21 -07:00
Benjamin Lichtman
7ac5fa783b Refactor and add wildcard scenario 2019-05-31 11:24:54 -07:00
Benjamin Lichtman
6b92ccaffa Respond to CR 2019-05-30 17:22:12 -07:00
Benjamin Lichtman
8c443b1481 Stop invalidating resolution when file stays open 2019-05-30 15:05:53 -07:00
Sheetal Nandi
ec2ee9ff3a Ignore anything starting with ".git"
Fixes #29782
2019-03-06 15:00:26 -08:00
Sheetal Nandi
4606a4b700
Merge pull request #28209 from Microsoft/ignorePathsStartingWithDotInNodeModules
Ignore any changes to file or folder that are in node_modules and start with "."
2018-10-30 18:06:00 -07:00
Andy
903e68164e
Redo resolution on ATA when previous resolution was to '.js' file (#28236)
* Redo resolution on ATA when previous resolution was to '.js' file

* Use a separate test case
2018-10-30 16:39:40 -07:00
Andy
acc34bd95d
Miscellaneous code cleanup relating to module resolution (#28092)
* Miscellaneous code cleanup relating to module resolution

* Revert if condition
2018-10-30 10:15:01 -07:00
Sheetal Nandi
d32c1b091a Ignore any changes to file or folder that are in node_modules and start with "."
Fixes #27673
2018-10-29 12:00:46 -07:00
Andy
070218f828
Remove DirectoryOfFailedLookupWatch#ignore, use DirectoryOfFailedLookupWatch | undefined (#28091) 2018-10-25 15:03:46 -07:00
Klaus Meinhardt
5b3fe6e68b update other interfaces and implementations
and accept baseline
2018-10-22 21:23:04 +02:00
Andy
72244c5b03
Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />'' (#28004)
* Support 'isSourceFileFromExternalLibrary' for source files from '/// <reference types="" />''

* Calculate `isExternalLibraryImport` at the end

* Calculate isExternalLibraryImport with symlink path
2018-10-19 18:00:45 -07:00
Sheetal Nandi
94df5167b0 Handle resolution caching when referenced tsconfig changes 2018-10-04 15:04:12 -07:00
Sheetal Nandi
6923f2cdb0 Handle caching of module resolution depending on project references 2018-10-04 15:04:11 -07:00
Sheetal Nandi
0e4b10d726 Use resolution options of project reference if the file is from the project reference 2018-10-04 15:04:10 -07:00
Sheetal Nandi
ee04b8c7f3 Handle the case of failed lookup location being not normalized.
Also fixed issue where type defs with relative name didnt resolve when directoryExists is present on the host
Fixes #27405
2018-09-28 14:40:34 -07:00
Nathan Shively-Sanders
64d0e0d448
Shorten more internal names to JS or TS (#27080) 2018-09-13 15:05:57 -07:00
Sheetal Nandi
fea1667002 Use string contains and nodeModulesPathPart const for "/node_modules/" 2018-08-15 11:47:16 -07:00
Sheetal Nandi
7bd1c8e6aa
Merge pull request #25811 from Microsoft/subDirectoryOfRootWatches
Watch subdirectories in project root instead of watching project root…
2018-07-31 11:51:16 -07:00
Sheetal Nandi
b31f242223 Reflect getCurrentProgram as Program|undefined in the ResolutionHostCache
If there were any exceptions, the getCurrentProgram might return undefined so this is defensive check for program
Fixes #25765
2018-07-20 12:20:39 -07:00
Sheetal Nandi
4ee3f2b3ea Watch subdirectories in project root instead of watching project root so as to avoid watching excluded directories that are not part of config file
Fixes #25629 and Microsoft/vscode#51139
2018-07-19 17:21:50 -07:00
Sheetal Nandi
f941226011 Do not watch modules that get resolved by ambient modules 2018-07-09 12:05:29 -07:00
Sheetal Nandi
cd97adbf3b Do not watch the parent folders recursively if not needed.
This avoids watching folders like parent folder of the project root just to watch files created in the folder
Fixes Microsoft/vscode#51139
2018-06-13 14:37:58 -07:00
Ryan Cavanaugh
5804905ca6 Jakefile rewrite WIP 2018-06-10 13:23:16 -07:00
Ryan Cavanaugh
336c37662d Projzilla phase 1 2018-06-09 16:48:08 -07:00
Sheetal Nandi
16e01174b7 Do not watch folders like "c:/users/username", "c:/users/username/folderAtRoot"
Fixes Microsoft/vscode#51139
2018-06-07 13:52:34 -07:00
Sheetal Nandi
939e3e4780 Instead of creating filter for subDirectories to watch in the ancestor directory of root, watch those subDirectories for failed lookup locations
Before this change, when failed lookup location didnt fall in root directory,
we tried to find the ancestor directory of the rootDirectory to watch.
We also created subDirectory map for the directories that are being watched so we dont go through invalidation if path is unwanted directory
With this change, we will watch those subdirectories instead of root. On windows node supports file system level recursive watching so the earlier approach was better because we reduced number of watches created
But on other os, since node doesnt support it, we create the watches for existing folders outselves, so earlier approach becomes expensive.
This should be better compromize to satisfy both types of OS.
Fixes #24434
2018-05-29 14:49:19 -07:00
Andy
e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Andy
4c22bf786e
getEditsForFileRename: Do fresh module resolution instead of relying on cache (#24211)
* getEditsForFileRename: Do fresh module resolution instead of relying on cache

* Add host.resolveModuleNameWithFailedLookupLocations method

* Make host.resolveModuleNameWithFailedLookupLocations mandatory, and implement for Project

* Add test, and no need to check host.fileExists

* Change method name and always use cache

* Update name in string
2018-05-18 16:42:42 -07:00