3987 Commits

Author SHA1 Message Date
Andy
e248d08e4c
Combine repeatString helper functions (#21235) 2018-01-17 12:43:41 -08:00
Andy
f96dc84a70
Make getCombinedCodeFix API public (#21234) 2018-01-17 12:42:31 -08:00
Andy
8ed885db3e
Add completions from the 'this' type (#21231)
* Add completions from the 'this' type

* Code review
2018-01-17 12:05:31 -08:00
Andy
be607bd28f
getStringLiteralCompletionEntries: switch on parent.type (#21169)
* getStringLiteralCompletionEntries: switch on parent.type

* Use a 'default' case and reduce findPrecedingToken calls

* fromType -> fromContextualType
2018-01-17 07:33:03 -08:00
Wesley Wigham
76d9524866
Fully deprecate the symbol display builder, reimplement in terms of node builder (#18860)
* Remove SymbolWriter, give methods to EmitTextWriter

* Unification of writers is done-ish

* Make node builder support more flags

* Write out mixins like we used to

* Accept prototype-free baselines

* Use instantiated constraint when building mapped type nodes

* Accept better mapped type baselines

* Report inaccessible this in node builder

* Turns out there was a bug in our codefix, too

* Symbol display builder usage falling

* Replace signatureToString with a nodeBuilder solution

* Replace the last internal usages of the symbol writer

* Accept semicolon additions

* Accept updated symbol baseline output

* Start using node builder for some LS operations

* Remove those pesky trailing semicolons on signatures

* Get signature printing much closer to old output

* Parameter lists should not be indented by default, especially when single-line

* Signatures up to snuff

* Type quickinfo emit is up to snuff

* Start of symbol writer replacement, needs a bit more for full compat

* Slightly mor accurate to old behavior

* Replicate qualified name type argument output correctly

* Bring back the old symbol baselines

* Mostly identical to old symbol emit now

* Perfectly matches old behavior thus far

* Replace another usage of the symbol builder

* Another usage removed

* Another usage removed

* Remove final uses of symbol display builder

* Remove implementation and types for unused symbol display builder

* Cleanup in the checker

* monomorphize new emitter code

* Replace emitWithSuffix

* Push space character to interface with writer

* List emit

* Fix lack of usage of emitExpression

* writeList, not printList

* Remove listy writes and replace with new printer calls

* Move ListFormat into types.ts

* Remove most new XToString functions in favor of node builder functions

* Accept API breaks

* Add getSymbolDisplayBuilder polyfill

* Accept updated API baseline

* Move definition to make diff easier to read

* Reinternalize some things

* Remove trailign whitespace

* Reorder for zero diff

* Remove newline

* Make shim mor eperfectly imitate old behavior

* Style feedback

* Rename reset to clear to maintain backcompat with SymbolWriter

* Fix quickfix

* Keep EmitTextWriter internal

* Remove EmitTextWriter from public API

* Mimic default name declaration emit fix

* Fix tests broken by merge

* use isFunctionLike

* Cleanup, sync TypeFormat and NodeBuilder flags

* Reorder Node initialization so pos and end are first, so a TextRange hidden class is made first to reduce future polymorphism

* Use variable instead of ternary

* Write helper for emitNodeWithWriter

* Emitter cleanup

* Cleanup whitespace, comment

* Reuse printer

* Raise error if display parts writer uses rawWrite

* Hide writer parameter through different function instead of overload, rename function in emitter

* Make less printer

* fix lint
2018-01-16 09:53:42 -08:00
Alan Agius
bcb9fd7825 fix: formatting for chaining methods (#21027)
Closes: #20996
2018-01-16 08:53:43 -08:00
Andy
d2fd137d88
Add a getFullText() helper method to IScriptSnapshot (#21155)
* Add a `getFullText()` helper method to `IScriptSnapshot`

* Use a function instead of a method
2018-01-12 10:44:39 -08:00
Andy
269867f5e8
Fix bug: get merged symbol of symbol.parent before checking against module symbol (#21147) 2018-01-11 13:42:08 -08:00
Andrew Casey
e3da8fb526
Merge pull request #21131 from amcasey/GH15533
Unmangle scoped package names in import completions
2018-01-11 11:03:34 -08:00
Andy
a77c6014b3
Parse comment on @property tag and use as documentation comment (#21119)
* Parse comment on @property tag and use as documentation comment

* Fix comment parsing bug -- back up after seeing `@` character

* Add test for indent

* Don't default comment to ""
2018-01-11 10:49:39 -08:00
Andrew Casey
9a4fe8eb7e Rename getPackageNameFromAtTypesDirectoryWithoutPrefix to getUnmangledNameForScopedPackage 2018-01-10 15:17:27 -08:00
Andrew Casey
71c92bf2f6 Fix lint error 2018-01-10 13:38:25 -08:00
Priyantha Lankapura
743d8dbe0a Fix to remove extra space between function and array index. (#21113)
https://github.com/Microsoft/TypeScript/issues/21111
2018-01-10 09:30:35 -08:00
Sharon Rolel
c0bdd12c4c add fixAwaitInSyncFunction code fix (#21069)
* add fixAwaitInSyncFunction code fix

* Just insert the keyword

* only one codefix

* remove comment

* Change explicit return type T to Promise<T>

* Review changes

* Change codefix message
2018-01-09 17:15:08 -08:00
Andrew Casey
e48312df54 De-dup typing module completions 2018-01-09 16:54:58 -08:00
Andrew Casey
db09a593d3 Unmangle package names from typings during completion 2018-01-09 16:45:42 -08:00
Andrew Casey
fa758cc357 Tidy up code to make it harder to call incorrectly 2018-01-09 15:33:54 -08:00
Andy
8bce69e6bd
Add refactoring to convert CommonJS module to ES6 module (#19916)
* Add refactoring to convert CommonJS module to ES6 module

* Code review

* includeGlobals -> excludeGlobals

* Improve handling of `module.exports = require("...")`

* Allow NoSubstitutionTemplateLiteral as argument to createLiteral
2018-01-09 13:15:47 -08:00
Andy
9aa99b90c7
Include directories in completions for path mapping (#21103) 2018-01-09 13:15:30 -08:00
Andy
fed34cd616
Fix bug: normalize path after combining (#21100) 2018-01-09 11:54:35 -08:00
Andy
82fb294924
For import fix, support path mapping value that begins in "./" or ends in ".ts" (#21035)
* For import fix, support path mapping value that begins in "./" or ends in ".ts"

* Handle repeated "./" in path

* Rename parameters to indicate that they're relative to baseUrl

* Support relative path beginning with `..\`

* Remove unused function
2018-01-09 10:34:35 -08:00
Andrew Casey
ef5a289966
Merge pull request #21014 from amcasey/GH19115
Handle different default export forms the same way in import code fixes
2018-01-08 19:07:43 -08:00
Andy
89ceb4b9b5
Support completions that require changing from dot to bracket access (#20547)
* Support completions that require changing from dot to bracket access

* Use insertText and replacementSpan

* Rename includeBracketCompletions to includeInsertTextCompletions

* Don't add completions that start with space
2018-01-08 18:57:46 -08:00
Wesley Wigham
7e6315075d
Synthesize namespace records for proper esm interop (#19675)
* Integrate importStar and importDefault helpers

* Accept baselines

* Support dynamic imports, write helpers for umd module (and amd is possible) kinds

* Accept baselines

* Support AMD, use same helper initialization as is normal

* update typechecker to have errors on called imported namespaces and good error recovery with a quickfix

* Overhaul allowSyntheticDefaultExports to be safer

* Put the new behavior behind a flag

* Rename strictESM to ESMInterop

* ESMInterop -> ESModuleInterop, make default for tsc --init

* Rename ESMInterop -> ESModuleInterop in module.ts, add emit test (since fourslash doesnt do that)

* Remove erroneous semicolons from helper

* Reword diagnostic

* Change style

* Edit followup diagnostic

* Add secondary quickfix for call sites, tests forthcoming

* Add synth default to namespace import type, enhance quickfix

* Pair of spare tests for good measure

* Fix typos in diagnostic message

* Improve comment clarity

* Actually accept the updated changes to the esmodule interop description

* ESModule -> esModule

* Use find and not forEach

* Use guard

* Rely on implicit falsiness of Result.False

* These should have been emit flags
2018-01-08 16:36:23 -08:00
Mohamed Hegazy
45a10c8401 Merge branch 'import-quickinfo' of https://github.com/jwbay/TypeScript into jwbay-import-quickinfo 2018-01-08 14:43:56 -08:00
Wenlu Wang
7154df10df add support for insertSpaceBeforeTypeAnnotation (#20466) 2018-01-08 13:25:02 -08:00
Andy
86eab34758
type-operator-spacing: Just check for presence of space, not double-space (#20817) 2018-01-08 12:29:43 -08:00
Andy
6d361f89e3
Move isObjectLiteralElement to public utilities (#20605) 2018-01-08 12:29:21 -08:00
Andy
97c3e9c3ef
Support all path mappings that end in "*" in completions (#21072)
* Support all path mappings that end in "*" in completions

* Check for uppercase TsConfig.JSON
2018-01-08 12:28:50 -08:00
Andy
20c846d671
Add helper functions to simplify getCompletionEntryDisplayNameForSymbol (#20552) 2018-01-08 11:48:25 -08:00
Andy
50fa0f61f5
Fix bug: Resolve module symbol before checking whether module export is a re-export (#20989)
* Fix bug: Resolve module symbol before checking whether module export is a re-export

* Remove unnecessary @nolib
2018-01-08 11:33:57 -08:00
Andy
f34de1a1ca
Support find-all-references starting from a reference path or reference types comment (#21007) 2018-01-08 11:33:14 -08:00
Andy
fc18f08e63
Remove 'indexOf' helper, use 'arr.indexOf()' (#20194) 2018-01-08 10:39:52 -08:00
Andy
6f2ba15446
Start linting for double spaces (#20820)
* Start linting for double spaces

* Code review

* Fix cases that were excluded by countDoubleSpaces

* Remove extraneous closing parenthesis
2018-01-08 08:52:13 -08:00
Daniel Rosenwasser
1041f09c27
Merge pull request #20941 from mariusschulz/stringCompletionsForIndexedAccessTypes
Return string completions for indexed access types
2018-01-06 21:07:00 -08:00
Andrew Casey
1957dfef8e
Merge pull request #20991 from amcasey/GH18794
Refine extends-to-implements code fix
2018-01-05 17:52:22 -08:00
Andrew Casey
4437476856
Merge pull request #21042 from amcasey/cannotFindModule
Make fixCannotFindModule return an empty array if there is no code action
2018-01-05 17:51:49 -08:00
Andy
e35585b938
Fix conflict between formatting rules (#21038) 2018-01-05 17:33:29 -08:00
Andrew Casey
18f9d693fe Stop limiting getEscapedNameForExportDefault to the first declaration 2018-01-05 16:29:53 -08:00
Andrew Casey
47aad0b8fd Switch to block-bodied lambda 2018-01-05 16:12:12 -08:00
Andrew Casey
ded788e560 Slightly simplify getCodeActions 2018-01-05 14:54:59 -08:00
Andrew Casey
8f5a76d48b Make fixCannotFindModule return an empty array if there is no code action 2018-01-05 14:24:40 -08:00
Andrew Casey
a0495a65fe Improve comment 2018-01-05 10:53:18 -08:00
Benjamin Lichtman
5bd477e441
Merge pull request #20924 from uniqueiniquity/jsxSpreadAttributeFormatting
Jsx spread attribute formatting
2018-01-05 10:27:47 -08:00
Marius Schulz
25c5e57091 Return string completions for indexed access types 2018-01-05 18:14:06 +01:00
Andrew Casey
a961d7aa04 Only replace implements with a comma if the heritage clauses are sensible 2018-01-04 18:05:58 -08:00
Andrew Casey
afae97ce6e Refine extends-to-implements code fix
1. Retain surrounding trivia when swapping the keyword.
 2. Insert commas at the full-starts, rather than starts, of existing
 keywords when merging with existing implements clauses.

Fixes #18794
2018-01-04 17:55:12 -08:00
Herrington Darkholme
67eabb98bc fix #20449, insert space between decorators (#20491) 2018-01-04 16:57:27 -08:00
Matt Bierner
12d5063e4c Add kindModifier to mark if a completion item is for an optional field (#20839)
* Add kindModifier to mark if a completion item is for an optional field

For #12458

Adds a new KindModifier for completion items to mark when a property is optional. This can be used by editors to either change the item icon or add a `?` to the item text

* Add method test

* Baseline-accept
2018-01-04 16:36:31 -08:00
Andrew Casey
50e3044ed2 Correct fullDisplayName returned from rename
The regular displayName had special handling for `as` clauses in imports
and exports but the fullDisplayName did not.  They should be consistent.

(The impact of this change is very minor - it only affects the root node
of the tree control in the rename preview, which is off by default.)

Bonus: Eliminate `getDeclaredName` which is only called by rename.

Note: Special handling of default exports was not preserved since
`default` cannot be renamed.
2018-01-04 15:34:20 -08:00