126 Commits

Author SHA1 Message Date
Klaus Meinhardt
95494efe50 fix commonPrefix handling 2018-08-08 16:58:35 +02:00
Ryan Cavanaugh
066b191982 Collapse core/compiler/parser into parser 2018-06-11 17:07:58 -07:00
Ryan Cavanaugh
ab10b86205 Almost working? 2018-06-10 19:28:38 -07:00
Wesley Wigham
d9b93903c0
Use more nodelike paths for import types when possible (#24610)
* Use more nodelike paths for import types when possible

* move functionality from services into compiler, fix with propert file/directory conflict handling

* mark suspect cast
2018-06-05 12:54:36 -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
Sheetal Nandi
dc50fe5e40 Apart from typing, use main field in package json to resolve typescript files
Fixes #23502
2018-05-14 14:52:11 -07:00
Sheetal Nandi
22d5b0e19f Do not remove extension js or jsx from the subModuleName if the subModule doesnt have js or jsx extension 2018-05-14 14:21:08 -07:00
Wesley Wigham
556c316fed
Make new harness fake host more performant in large complications (#23951)
* Make new harness fake host more performant in large complications

* Use sortedmap
2018-05-08 12:46:33 -07:00
Sheetal Nandi
15f9ea3d14 Merge branch 'master' into requireJson 2018-05-03 15:35:54 -07:00
Sheetal Nandi
579748bc2b Merge branch 'master' into requireJson 2018-04-30 11:44:09 -07:00
Ron Buckton
8424c4d1ab Partial migration of some shared vpath functionality to core 2018-04-27 13:58:45 -07:00
Andy
5c94bef0e1
Add 'renameFile' command to services (#23573)
* Add 'renameFile' command to services

* renameFile -> getEditsForFileRename

* Support `<reference path>` directives
2018-04-20 13:43:09 -07:00
Sheetal Nandi
ce08af4dfe Merge branch 'master' into requireJson 2018-04-13 15:26:16 -07:00
Ryan Cavanaugh
8294259ec2 Remove all reference comments from compiler/ 2018-04-11 15:38:26 -07:00
Andy
70682b7799
Clean up code for nonrelative path completions (#23150)
* Clean up code for nonrelative path completions

* Remove unnecessary test and simplify based on that

* More code review

* Call getCompletionEntriesFromTypings unconditionally
2018-04-06 12:19:08 -07:00
TravCav
60bd7e861c removed always true condition 2018-04-06 12:23:41 -04:00
Sheetal Nandi
a14396320b Resolve json modules only when --resolveJsonModule is specified 2018-04-05 15:37:13 -07:00
Sheetal Nandi
9f724156be Merge branch 'master' into requireJson 2018-04-05 15:18:21 -07:00
Benjamin Lichtman
d2d0f86831
Merge pull request #20374 from uniqueiniquity/symlinkTypeReferenceDirective
Handle failure to properly resolve type reference directives
2018-03-29 15:26:30 -07:00
Ryan Cavanaugh
1e66f071fd Always include parent folder failed lookup locations 2018-03-23 14:42:16 -07:00
Sheetal Nandi
2071466420 Merge branch 'master' into requireJson 2018-03-08 13:24:59 -08:00
Josh Goldberg
7826b38426 Apply 'no-unnecessary-initializer' lint rule (#22014)
* Apply 'no-unnecessary-initializer' lint rule

Forbids `let`/`const` statements to be initialized to `undefined`, since that's the initial value by default anyway.
The auto-fixer also happened to remove two unnecessary `as number` casts in `src/harness/parallel/worker.ts`.

For historical data: to run with `--fix`, I modified the line in `Jakefile.js` that declared the `cmd` for running TSLint.

* Moved worker.ts type assertions to parameters
2018-03-06 07:30:40 -08:00
Andy
a564912d9a
Apply 'no-unnecessary-qualifier' lint rule (#22009) 2018-03-01 14:20:18 -08:00
Sheetal Nandi
005a50f587
Merge pull request #22136 from Microsoft/moduleResolution
Use cache for the non-relative module resolution and enhance the watches for failed lookup locations
2018-02-28 14:39:22 -08:00
Andy
e4e4b17669
Improve error message for untyped import of scoped package (#22189) 2018-02-26 10:38:54 -08:00
Sheetal Nandi
4257c2fa04 Resolve the .json file only if module name contains the extension 2018-02-23 17:27:17 -08:00
Sheetal Nandi
ca590d6fed Need allowJs to be true to use the json module resolution 2018-02-23 14:00:23 -08:00
Sheetal Nandi
5771adbbe7 Resolve Json file when module resolution strategy is node 2018-02-23 13:54:39 -08:00
Sheetal Nandi
fdb5e95f0a Use the module cache to resolve non relative module name as well 2018-02-22 15:44:13 -08:00
Wesley Wigham
b0ea899d13
Use the full local file path as the id for a submodule (#21471)
* Use the full file path as the id for a submodule

* Informal code review feedback
2018-01-30 11:09:48 -08:00
uniqueiniquity
4a87789779 Fix typo in message 2018-01-19 16:40:52 -08:00
uniqueiniquity
46fa477c15 Move assertion to realpath evaluation 2018-01-19 16:23:24 -08:00
Andy
b363f4f9cd
Log packageId in --traceResolution (#21233) 2018-01-17 11:41:23 -08:00
Andy
61fb845b87
Get packageId for relative import within a package (#21130)
* Get packageId for relative import within a package

* Code review

* Rename things and add comments

* Improve documentation

* Test for scoped packages
2018-01-17 11:14:03 -08:00
Andrew Casey
9a4fe8eb7e Rename getPackageNameFromAtTypesDirectoryWithoutPrefix to getUnmangledNameForScopedPackage 2018-01-10 15:17:27 -08:00
Andrew Casey
db09a593d3 Unmangle package names from typings during completion 2018-01-09 16:45:42 -08:00
Andy
18a7c3fb53
For import fix, prefer symlink over a real path (#20395)
* For import fix, prefer symlink over a real path

* fixes

* Use best result from all symlinks

* Make originalPath optional more

* Only include real path if a symlink isn't available
2017-12-06 11:27:38 -08:00
Andy
d05443bb1d Add quickfix and refactoring to install @types packages (#19130)
* Add quickfix and refactoring to install @types packages

* Move `validatePackageName` to `jsTyping.ts`

* Remove combinePaths overloads

* Respond to code review

* Update api baselines

* Use native PromiseConstructor

* Return false instead of undefined

* Remove getProjectRootPath

* Update api
2017-10-17 15:04:09 -07:00
Andy
2b566b9a53 Add exported members of all project files in the global completion list (#19069)
* checker.ts: Remove null check on symbols

* tsserverProjectSystem.ts: add two tests

* client.ts, completions.ts, types.ts: Add codeActions member to CompletionEntryDetails

* protocol.ts, session.ts: Add codeActions member to CompletionEntryDetails protocol

* protocol.ts, session.ts, types.ts: add hasAction to CompletionEntry

* session.ts, services.ts, types.ts: Add formattingOptions parameter to getCompletionEntryDetails

* completions.ts: define SymbolOriginInfo type

* completions.ts, services.ts: Add allSourceFiles parameter to getCompletionsAtPosition

* completions.ts, services.ts: Plumb allSourceFiles into new function getSymbolsFromOtherSourceFileExports inside getCompletionData

* completions.ts: add symbolToOriginInfoMap parameter to getCompletionEntriesFromSymbols and to return value of getCompletionData

* utilities.ts: Add getOtherModuleSymbols, getUniqueSymbolIdAsString, getUniqueSymbolId

* completions.ts: Set CompletionEntry.hasAction when symbol is found in symbolToOriginInfoMap (meaning there's an import action)

* completions.ts: Populate list with possible exports (implement getSymbolsFromOtherSourceFileExports)

* completions.ts, services.ts: Plumb host and rulesProvider into getCompletionEntryDetails

* completions.ts: Add TODO comment

* importFixes.ts: Add types ImportDeclarationMap and ImportCodeFixContext

* Move getImportDeclarations into getCodeActionForImport, immediately after the implementation

* importFixes.ts: Move createChangeTracker into getCodeActionForImport, immediately after getImportDeclarations

* importFixes.ts: Add convertToImportCodeFixContext function and reference it from the getCodeActions lambda

* importFixes.ts: Add context: ImportCodeFixContext parameter to getCodeActionForImport, update call sites, destructure it, use compilerOptions in getModuleSpecifierForNewImport

* importFixes.ts: Remove moduleSymbol parameter from getImportDeclarations and use the ambient one

* importFixes.ts: Use cachedImportDeclarations from context in getCodeActionForImport

* importFixes.ts: Move createCodeAction out, immediately above convertToImportCodeFixContext

* Move the declaration for lastImportDeclaration out of the getCodeActions lambda into getCodeActionForImport

* importFixes.ts: Use symbolToken in getCodeActionForImport

* importFixes.ts: Remove useCaseSensitiveFileNames altogether from getCodeActions lambda

* importFixes.ts: Remove local getUniqueSymbolId function and add checker parameter to calls to it

* importFixes.ts: Move getCodeActionForImport out into an export, immediately below convertToImportCodeFixContext

* completions.ts: In getCompletionEntryDetails, if there's symbolOriginInfo, call getCodeActionForImport

* importFixes.ts: Create and use importFixContext within getCodeActions lambda

* importFixes.ts: Use local newLineCharacter instead of context.newLineCharacter in getCodeActionForImport

* importFixes.ts: Use local host instead of context.host in getCodeActionForImport

* importFixes.ts: Remove dummy getCanonicalFileName line

* Filter symbols after gathering exports instead of before

* Lint

* Test, fix bugs, refactor

* Suggestions from code review

* Update api baseline

* Fix bug if previousToken is not an Identifier

* Replace `startsWith` with `stringContainsCharactersInOrder`
2017-10-17 10:20:11 -07:00
Andy
2cb0403e2d Support 'package.json' not in package root (#19133)
* Support 'package.json' not in package root

* Test "foo/@bar"

* More tests, and don't use "types" from the root package.json if not loading the root module
2017-10-16 13:02:15 -07:00
Sheetal Nandi
e30a66d22f Add utitlity for stringContains 2017-10-10 17:16:39 -07:00
Sheetal Nandi
23acff5bc8 Merge branch 'master' into watchImprovements 2017-09-25 16:18:26 -07:00
Andy
d5e7227dbb Look at correct 'package.json' location for a scoped package (#18580)
* Look at correct 'package.json' location for a scoped package

* Update baseline
2017-09-20 08:15:24 -07:00
Sheetal Nandi
fdb104b242 Merge branch 'master' into watchImprovements 2017-09-11 13:49:36 -07:00
Andy
2e02778960 When loading a module from node_modules, get packageId even in the loadModuleFromFile case (#18185)
* When loading a module from node_modules, get packageId even in the `loadModuleFromFile` case

* Support packageId for <reference types> too
2017-09-07 14:31:20 -07:00
Sheetal Nandi
54f64a1695 Resolution is valid unless it is invalidated 2017-09-05 19:22:32 -07:00
Sheetal Nandi
60e2e68dfb Merge branch 'watchImprovements' into builder 2017-08-18 13:38:24 -07:00
Andy
eef7d8bd3d Treat explicit imports from node_modules as external library imports (#16364)
* Treat explicit imports from `node_modules` as external library imports

* Update baselines
2017-08-17 13:26:38 -07:00
Andy
93abebc04a Change function name to camelCase (#17751) 2017-08-15 12:26:00 -07:00
Sheetal Nandi
d0a23bb876 Merge branch 'watchImprovements' into builder 2017-08-12 15:35:30 -07:00