Commit Graph
4864 Commits
Author SHA1 Message Date
BigAru e697856a7d change refactor name 2018-10-31 14:27:36 +01:00
BigAru 367f47e755 fix multi decl bug 2018-10-31 14:27:36 +01:00
BigAru 4c80de9078 add multi vardecl 2018-10-31 14:27:36 +01:00
BigAru f558f2f6cd add working getEditsForAction 2018-10-31 14:27:36 +01:00
BigAru 6cfbee7f30 add getAvailableActions 2018-10-31 14:27:36 +01:00
BigAru 8cb019d793 add skeleton 2018-10-31 14:27:36 +01:00
AndyandGitHub dce6668070 Change pathCompletions to stringCompletions, move more code there (#28245) 2018-10-30 22:01:31 -07:00
AndyandGitHub 3458360322 Prefer getValidSourceFile over Debug.assertDefined(program.getSourceFile(*)) (#28242) 2018-10-30 16:38:52 -07:00
Nathan Shively-SandersandGitHub 0481d44501 Bad callsite inferences fall back to body usage (#28235)
For parameters, the infer-from-usage codefix uses a substantially
different codepath that previously only looked at call site uses. When
this resulted in no inferences, or bad inferences, for a single
parameter, the codefix would just use any. Only if no usages of a
function were found would the codefix use the body-inference
code.

This commit makes parameter inference fall back to body-inference code
for individual parameters when there is no inference or inference to
any.
2018-10-30 13:25:24 -07:00
AndyandGitHub 437bc41e99 For path completions, include extension as a kindModifier (#28148) 2018-10-30 11:56:34 -07:00
AndyandGitHub 1c4590341f Avoid reformatting body of arrow function with single unused parameter (#28217) 2018-10-29 16:40:30 -07:00
Nathan Shively-SandersandGitHub 60efb65931 infer-from-usage suggestions can't be ignored, and always do something when invoked. (#28206)
* Do not ts-ignore noImplicitAny suggestions

Still need to write tests.

* Add tests

* More tests

* Update baselines
2018-10-29 13:23:33 -07:00
AndyandGitHub 672b0e3e16 Have flatMap return a ReadonlyArray by default (#28205) 2018-10-29 11:12:51 -07:00
AndyandGitHub 77d8e15905 Remove unused property ParameterInference#typeNode (#28115) 2018-10-26 14:44:49 -07:00
Nathan Shively-SandersandGitHub 372c7d9b0c infer from usage JSDoc:Don't emit nested comments (#28161)
* infer from usage JSDoc:Don't emit nested comments

Previously, the trivia on a parameter name would show up inside the
emitted JSDoc comment. If the trivia contained a C-style comment, the
emitted JSDoc comment would be invalid. For example:

```js
function call(callback /*oh no*/) {
  return callback(this)
}
```

Emitted this comment:

```js
/**
 * @param {(arg0: any) => void} callback /*oh no*/
 */
```

* Remove misleading comment used for debugging.
2018-10-26 14:09:42 -07:00
AndyandGitHub 42740d66c2 Improve performance of suggestionDiagnostics for convertToAsyncFunction (#28089) 2018-10-24 21:23:47 -07:00
Nathan Shively-SandersandGitHub 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
AndyandGitHub e46c846ee6 Remove getBucketForCompilationSettings (#28088) 2018-10-24 15:37:46 -07:00
AndyandGitHub eadf44d073 Add generateTypesForModule to public API (#28069)
* Add generateTypesForModule to public API

* Avoid parameter initializer and update baselines
2018-10-23 16:10:26 -07:00
Wesley WighamandGitHub 0a7c92864d Fix Object.defineProperty declaration expando-ness and renames (#28061)
* Allow object.defineProperty calls to be expando properties

* Fix rename locations for object.defineProperty assignments
2018-10-23 09:33:53 -07:00
AndyandGitHub 5becc3b170 Rename of non-intrinsic JSX element should rename the declaration (#28066) 2018-10-22 18:17:32 -07:00
AndyandGitHub 82773b8550 Fix bug: only getCompletionEntriesFromTypings if completions are for top-level directory (#27226)
* Fix bug: only getCompletionEntriesFromTypings if completions are for top-level directory

* Support subdirectories of a nonrelative import
2018-10-22 18:17:09 -07:00
Sheetal NandiandGitHub 7ed9e44055 Merge pull request #28059 from ajafff/lsh-resolve-return-type
fix return type of resolveModuleNames and resolveTypeReferenceDirectives
2018-10-22 18:09:15 -07:00
Wesley WighamandGitHub 76addd75d1 Add JSXText check into isValidLocationToAddComment (#27653)
* Add JSXText check into isValidLocationToAddComment

* Small simplification
2018-10-22 16:45:39 -07:00
Klaus Meinhardt 5b3fe6e68b update other interfaces and implementations
and accept baseline
2018-10-22 21:23:04 +02:00
Klaus Meinhardt 96480b5ba9 fix return type of LangageServiceHost.resolve*
Fixes: #28058
2018-10-22 20:59:42 +02:00
AndyandGitHub 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
Sam DruganandAndy 02c74987b7 added await keyword to completions and added test (#27912) 2018-10-22 11:32:49 -07:00
AndyandGitHub 8e0142d709 Support import completions for a re-export with a different name from the original (#28055) 2018-10-22 11:16:39 -07:00
Wesley WighamandGitHub 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
AndyandGitHub a3c22683ab findAllRefs: Fix bug when symbol.declarations is undefined (#27977) 2018-10-18 14:27:21 -07:00
Sheetal NandiandGitHub 91bb32ade4 Merge pull request #27560 from Microsoft/transitiveReferences
Resolve modules, type reference directives in context of referenced file
2018-10-18 13:03:10 -07:00
Wesley WighamandGitHub e58371e03a Remove now unnessesary casts (#27954) 2018-10-17 15:17:21 -07:00
Wesley WighamandGitHub 7b5ef64e76 Unify JSX And Normal Call Checking Codepaths (#27627)
* Unify JSX Call Checking Codepaths

* Add tests for fixed issues

* Fix lint, move all error checking into the only-run-once resolveSignature call

* Remove unused (unreachable?) code path

* Consolidate a little more duplicated logic into signature checking

* Fix #19775 a bit more

* Cosmetic changes from CR
2018-10-16 20:16:00 -04:00
Sheetal Nandi b69622a114 Merge branch 'master' into transitiveReferences 2018-10-16 10:41:17 -07:00
Sheetal Nandi e3bfec5217 Handle when advancing past , of call expression moves past endPos of formatting
Fixes #26513
2018-10-12 16:06:24 -07:00
Sheetal Nandi ae1bd8bc33 Merge branch 'master' into transitiveReferences 2018-10-11 11:33:23 -07:00
AndyandGitHub dd764b318f importFixes: Skip alias when testing isTypeOnlySymbol (#27674) 2018-10-10 13:45:52 -07:00
Sheetal Nandi 88f79de9f4 Merge branch 'master' into transitiveReferences 2018-10-09 14:03:58 -07:00
Nathan Shively-SandersandGitHub 53906f222f containsTopLevelCommonjs:handle uninitialised vars (#27642)
Previously it assumed that all variable declarations had an initialiser,
which is not correct.
2018-10-09 13:17:54 -07:00
Nathan Shively-SandersandGitHub 88d3c6fd5f inferFromUsage codefix now emits JSDoc in JS files (#27610)
* Now adding @type to variable declarations, at least

Probably everything else, but not as well.

* Improve @param output and add test

It's still bad, but at least it's not wrong.

* Add some js/inferFromUsage tests and fixes

Also, remove redundant is(Set|Get)Accessor functions.

* Fix @typedef refactor

* Emit JSDoc optional parameters

By surrounding the parameter name with brackets. It is super, super ugly
right now.

* Get rest of existing tests working

* Correct location of comments

* Handle @param blocks

1. Format multiple params nicely in a single-multiline block.
2. Generate only params that haven't already been documented. Existing
documentation is not touched.

* Re-add isGet/SetAccessor -- it is part of the API

* Move isSet/GetAccessor back to the original location

* Oh no I missed a newline and a space

* Switch to an object type

* A lot of cleanup

More to come, though. annotate is only called in
annotateVariableDeclaration where we don't know whether we're in JS or
not.

* Move and delegate to annotateJSDocParameters

* Address PR comments

* Lint: newline problems!!!!

* Switch another call to getNonformattedText

* Update baseline missed after merge
2018-10-09 10:38:46 -07:00
Nathan Shively-SandersandGitHub ca94d8efd9 Infer from usage better import types (#27626)
* Use host to improve SymbolTracker implementation

* inferFromUsage: Provide a better moduleResolverHost

This produces better paths on import types.
2018-10-09 07:12:09 -07:00
Benjamin LichtmanandGitHub 6afa880aa3 Merge pull request #27573 from uniqueiniquity/alwaysAwait
Always await expression of promise type in return position
2018-10-08 08:47:44 -07:00
Daniel RosenwasserandGitHub 8474949336 Merge pull request #27203 from sbaidon/signatureHelpInAdjacentBlockBody
Fix signature help not showing in block body bug
2018-10-07 23:07:59 -07:00
Benjamin Lichtman 2ebd986d99 Always await expression of promise type in return position 2018-10-05 09:59:22 -07:00
Sheetal Nandi 94df5167b0 Handle resolution caching when referenced tsconfig changes 2018-10-04 15:04:12 -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
AndyandGitHub 16766b196c textChanges: Reuse some methods (#27492) 2018-10-02 17:34:17 -07:00
Ryan CavanaughandGitHub c04faa1e5b Merge pull request #27485 from IllusionMH/fix-completionInfo-exception-27338
Use safe some function to handle undefined declarations (fixes #27338)
2018-10-02 11:28:38 -07:00
Alessandro VerganiandGitHub bbf77538c4 Remove unneeded check from getTransformationBody
Remove unneeded `argName` check, because it always evaluates to `true` (the `false` case is handled just before the modified line)
2018-10-02 16:02:04 +02:00