Commit Graph

473 Commits

Author SHA1 Message Date
Sheetal Nandi
0a8c47bd45 Refactoring to createSourceMapperHost 2018-12-06 15:22:38 -08:00
Klaus Meinhardt
1ad7b0fe69 forEachToken: correctly handle JSDocTag (#28369)
* forEachChild: handle JSDocTags and all their children

* fix codefix for unused identifier

* fix lint

* fix build

* Fix test failures
2018-11-15 13:22:25 -08:00
Andy
2600250a24 Add 'bigint' to type keywords (#28537) 2018-11-14 22:18:05 -08:00
Andy
da37457c72 When renaming an imported symbol, rename only in current file (#28406)
* When renaming an imported symbol, rename only in current file

* Improve re-export references

* Remember to use 'range' in for loop

* Uncomment tests
2018-11-14 09:09:00 -08:00
Ron Buckton
151dc074a8 Merge branch 'master' into sourceMapGenerator 2018-11-09 11:50:51 -08:00
Klaus Meinhardt
e2947fac1c remove even more redundant internal comments 2018-11-07 16:12:48 +00:00
Caleb Sander
28e9ec497c Address review comments 2018-11-05 11:36:32 -08:00
Andy
dce6668070 Change pathCompletions to stringCompletions, move more code there (#28245) 2018-10-30 22:01:31 -07:00
Nathan Shively-Sanders
fe2a33fcbc Merge existing JSDoc comments (#27978)
* Correct indentation, using correct (I hope) indentation code

Note that part of the code, in formatting.ts, is cloned but should be
extracted to a function instead.

* Remove some possibly-superfluous code

But I see 4 failures with whitespace, so perhaps not.

* Restrict indentation change to avoid breaking baselines

The indentation code is very complex so I'm just going to avoid breaking
our single-line tests for now, plus add a simple jsdoc test to show that
multiline jsdoc indentation isn't destroyed in the common case.

* Switched over to construction for @return/@type

Still doesn't merge correctly though

* Add @return tags to emitter

* Merge multiple jsdocs

(not for @param yet)

* Merge multiple jsdoc for parameters too

* Emit more jsdoc tags

Not all of them; I got cold feet since I'll have to write tests for
them. I'll do that tomorrow.

* Many fixes to JSDoc emit

And single tests (at least) for all tags

* Cleanup in textChanges.ts

* Cleanup in formatting.ts

(Plus a little more in textChanges.ts)

* Cleanup in inferFromUsage.ts

* Fix minor omissions

* Separate merged top-level JSDoc comments with \n

instead of space.

* Don't delete intrusive non-jsdoc comments

* Cleanup from PR comments

1. Refactor emit code into smaller functions.
2. Preceding-whitespace utility is slightly easier to use.
3. Better casts and types in inferFromUsage make it easier to read.

* Fix bogus newline

* Use @andy-ms' cleanup annotateJSDocParameters
2018-10-24 16:14:52 -07:00
Wesley Wigham
76addd75d1 Add JSXText check into isValidLocationToAddComment (#27653)
* Add JSXText check into isValidLocationToAddComment

* Small simplification
2018-10-22 16:45:39 -07:00
Andy
d3d4f83f89 Remove hack to get target of GetAccessor symbol (#27868)
* Remove hack to get target of GetAccessor symbol

* Add tests and get moveToNewFile to work with binding patterns
2018-10-22 11:44:06 -07:00
Wesley Wigham
69b1cb5bac Add new special assignment kinds for recognizing Object.defineProperty calls (#27208)
* Add new special assignment kinds for recognizing Object.defineProperty calls

* Add support for prototype assignments, fix nits

* Fix code review comments

* Add test documenting behavior in a few more odd scenarios
2018-10-19 14:31:55 -07:00
Ron Buckton
4982803a38 Merge branch 'master' into sourceMapGenerator 2018-10-08 18:01:37 -07:00
Andy
0a97663843 Add 'prefixText' and 'suffixText' when renaming shorthand properties (#27356)
* Add 'prefixText' and 'suffixText' when renaming shorthand properties

* Make prefixText and suffixText missing instead of undefined

* Fix test
2018-09-26 16:58:01 -07:00
Benjamin Lichtman
0e985eb342 Merge branch 'master' into asyncCatchUniqueNames 2018-09-14 09:50:27 -07:00
Benjamin Lichtman
13deedf841 Merge pull request #26930 from uniqueiniquity/onlyReportExpectedPromiseArgs
Only perform async code fix if it can successfully refactor all parts
2018-09-14 09:41:34 -07:00
Andy
95c1570c4b Fix bug: VariableDeclaration may have SemanticMeaning.All if an @enum in JS (#27085) 2018-09-14 09:20:54 -07:00
Benjamin Lichtman
d12110d3e5 Respond to CR 2018-09-13 09:32:38 -07:00
Nathan Shively-Sanders
6bd1da20c9 Rename JS-specific concepts (#26795)
* Rename JS concepts

1. Assignment declaration -- an assignment that is treated like a
declaration. Previously called [JS] special (assignment|declaration),
among other things.
2. Expando -- a value that can be used as a target in assignment
declarations. Currently, a class, function or empty object literal.
Functions are allowed in Typescript, too. Previously called a JS
container, JS initializer or expando object.
3. JavaScript -> Javascript. This is annoying to type, and looks like
'Java Script' in a camelCase world.

Everything is a pure rename as far as I know. The only test change is
the API baselines, which reflect the rename from SymbolFlags.JSContainer
to SymbolFlags.Assignment.

* Remove TODO

* Rename Javascript->JS

Note that this introduces a variable name collision in a couple of
places, which I resolved like this:

```ts
const isInJavascript = isInJSFile(node);
```
2018-09-12 10:44:46 -07:00
Benjamin Lichtman
8c9e8666ed Miscellaneous cleanup 2018-09-11 11:12:10 -07:00
Benjamin Lichtman
95d57885c5 Ensure diagnostic reporting matches code fix ability 2018-09-07 14:14:01 -07:00
Andy
cbde861af6 Improve use of SemanticMeaning in symbol display (#26953) 2018-09-07 12:23:23 -07:00
Andy
1eb3082387 Support completions inside JSDoc before EndOfFileToken (#25568) 2018-09-05 11:34:27 -07:00
Andy
bcb815b3ac Remove duplicate function createTextRange (#23346)
* Remove duplicate function createTextRange

* Always allow end=-1

* Put noAssert back, pending #23370

* Use getRangeUnion helper

* Update API (#24966)
2018-09-05 11:19:56 -07:00
Ron Buckton
173b5dfcfb Refactor sourcemap emitter 2018-08-22 12:42:36 -07:00
Elizabeth Dinella
421730a68d Refactoring promises returning functions to use async and await (#26373) 2018-08-10 16:11:45 -07:00
Andy
08f5edbd03 Treat NoSubstitutionTemplateLiteral like StringLiteral in more places (#26330)
* Treat NoSubstitutionTemplateLiteral like StringLiteral in more places

* Move isStringOrNumericLiteral closer to its only use
2018-08-10 16:00:08 -07:00
Andy
5efd1cb4a7 fixAddMissingMember: Support interface and don't crash on type parameter (#25995)
* fixAddMissingMember: Support interface and don't crash on type parameter

* Remove InfoBase
2018-08-09 17:32:28 -07:00
Andy
d0ed21cad1 completions: 'true' and 'false' are type keywords (#26237) 2018-08-06 12:42:56 -07:00
Andy
d40d54984e Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
Andy
0227997fa5 Use import().T for import completions/fixes of pure types in JS files (#25852)
* Use `import().T` for import completions/fixes of pure types in JS files

* Don't call tryUseExistingNamespaceImport if position undefined
2018-07-26 16:16:57 -07:00
Andy
f12e9a8389 Minor refactor in goToTypeDefinition (#25951) 2018-07-25 17:10:06 -07:00
Andy
f9764d17f0 fixUnusedIdentifier: Support deleting @template tag (#25597)
* fixUnusedIdentifier: Support deleting @template tag

* Just return createTextRangeFromNode instead of adjusting range
2018-07-12 11:26:17 -07:00
Andy
5f4a03c408 Ensure TypeChecker#getTypeAtLocation returns a defined result (#25583)
* Ensure TypeChecker#getTypeAtLocation returns a defined result

* Update additional baseline
2018-07-11 16:33:56 -07:00
Andy
52486ae362 Improve isPossiblyTypeArgumentPosition (#25043)
* Improve isPossiblyTypeArgumentPosition

* Update API (#24966)

* Handle new Type<Type<

* Add test for `new C < C<`
2018-07-11 11:15:04 -07:00
Andy
72be7156d2 Support completions for unique symbol exported from module (#25537) 2018-07-10 10:47:43 -07:00
Pi Lanningham
b3b6c3bdbc Pass sourceFile to getChildren in getTokenAtPositionWorker (#25505) (#25538)
For performance reasons, we should always pass sourceFile to getChildren
if available.
2018-07-09 18:15:40 -07:00
Wesley Wigham
831be5d078 Introduce truncation into node builder and symbol display part writer (#24258)
* Introduce truncation into node builder and symbol display part writer

* Change default maxa truncation length to 240

* Fancy truncation + higher hard limit
2018-07-06 14:58:46 -07:00
Andy
64555aa6a9 navigateTo: Collect results from all referenced projects. (#25283)
* navigateTo: Collect results from all referenced projects.

* Don't use project references, just source maps

* Move more code to session

* Test when implementation file is deleted

* Use tsserver tests instead of fourslash tests to ensure session is used

* Support find-all-references

* Restore fourslash tests

* Update emit baselines (added missing newline)

* Support rename

* @weswigham code review

* Don't open/close files

* Avoid growing `toDo` too eagerly

* @sheetalkamat code review

* Also get symlinked projects for originalLocation

* Update API (#24966)

* More @sheetalkamat code review

* Remove unnecessary test

* Update API (#24966)
2018-07-05 15:39:03 -07:00
Andy
efc1b7df08 More thoroughly test navigateTo (#25239)
* More thoroughly test navigateTo

* Fix #25233 and #25237

* Update API (#24966)
2018-07-02 19:25:27 -07:00
Andy Hanson
f3bc891ae9 fixAddMissingMember: Improve deduplication in code-fix-all 2018-07-02 11:26:50 -07:00
Andy
a1746d4cfe Use helper functions in a few more places (#21308)
* Use helper functions in a few more places

* Fix typo

* Update API (#24966)
2018-06-29 20:07:42 -07:00
Andy
e7543d6d81 Simplify getRangeOfEnclosingComment (#25168) 2018-06-29 16:58:28 -07:00
Andy
48d31eddc8 Split isConst into isVarConst and isEnumConst (#25312) 2018-06-29 16:47:11 -07:00
Nathan Shively-Sanders
5c2eeb20b1 Destructuring declaration prefers type annotation type (#25282)
* Destructuring declaration prefers type annotation type

Previously, getTypeForBindingElement would always union the declarations type and
the type of the default initializer. Now, if the declaration has a type
annotation, it does not union with the initializer type. The type
annotation's type is the one used.

* Small cleanup in parentDeclarationHasTypeAnnotation

* Refactoring based on PR comments

* Combine getCombined*Flags into a single helper function

Retain the individual functions since they are used a lot.

* Remove unneeded temp
2018-06-28 10:41:38 -07:00
Andy
1cb691f52d findPrecedingToken: default includeJsDocComment to true (#25262)
* findPrecedingToken: default includeJsDocComment to true

* Add exception for smartIndenter
2018-06-27 12:14:41 -07:00
Andy
c9d44ce395 getTouchingToken: default includeJsDocComment to true (#25258) 2018-06-27 11:15:15 -07:00
Andy
d957b1c8c2 fixUnusedIdentifier: Remove arguments corresponding to unused parameters (#25011)
* fixUnusedIdentifier: Remove arguments corresponding to unused parameters

* Update API (#24966)

* Fix handling of deletions: Make a list of things to delete and don't delete until the end

* Remove dummy test

* Bug fixes

* Update API (#24966)

* Move code to textChanges
2018-06-27 09:26:47 -07:00
Andy
13bc46d970 getTokenAtPosition: default includeJsDocComment to true (#25015)
* getTokenAtPosition: default includeJsDocComment to true

* Update API (#24966)

* Flip meaning of parameter

* Update API (#24966)

* Remove all `ignoreJsDocComment` uses (fixes #25162)
2018-06-26 16:20:44 -07:00
Andy
806a661be3 Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00