50 Commits

Author SHA1 Message Date
Andy
813864f021
For import completion, use an existing namespace import (#20457) 2017-12-21 11:16:09 -08:00
Andrew Casey
adc3234e46 Don't insert a blank line after extracted locals at the start of the file 2017-12-15 15:49:27 -08:00
Andy
8ad4aeece1
Make ChangeTracker#newLineCharacter public, to avoid having to pass newLineCharacter around as a parameter (#20574)
* Make ChangeTracker#newLineCharacter public, to avoid having to pass newLineCharacter around as a parameter

* Don't require newLineCharacter as input to ChangeTracker methods, and make it private again
2017-12-12 12:23:13 -08:00
Andy
19ea189b42
Support a "getCombinedCodeFix" service (#20338)
* Support a "getCombinedCodeFix" service

* Rename things

* Code review

* Rename things

* Update API baselines

* CodeActionAll -> CombinedCodeActions

* Take a `scope` parameter instead of `fileName` for flexibility

* Renames and bugfixes

* Make API changes internal

* Code review

* Update comment
2017-12-07 12:14:18 -08:00
Andy
8f23bf813c
Add textChanges methods to insert nodes at the start of multiline bodies (#20445)
* Add textChanges methods to insert nodes at the start of multiline bodies

* Replace constructor body if not already multiline
2017-12-05 08:33:29 -08:00
Andy
5ad7e9516b
Remove unnecessary wrapper classes in ts.formatting.Rule (#19744)
* Remove unnecessary wrapper classes in ts.formatting.Rule

* RulesProvider -> immutable FormatContext

* Remove Rules class, just use a list of rules

* Remove Shared namespace, replace Shared.TokenRange with TokenRange

* Simplify TokenRange

* Separate Rule and RuleSpec

* Move FormattingRequestKind to formattingContext.ts

* Simplify references

* Fix lint

* Revert removal of trailing newlines
2017-11-08 13:39:03 -08:00
Andy
1f282f19e0 Fix "noStringLiteral" lint errors (#19310) 2017-10-19 08:15:48 -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
7e002aeb7b Avoid calling indexOf when checking array element types (#18619)
* Avoid calling `indexOf` when checking array element types

* Add 'indexOfNode' and use it in cases which may handle long lists. (#18635)

* Fix bug where contextual type was not reused if undefined
2017-09-22 08:49:56 -07:00
Nathan Shively-Sanders
3cc0aeb6be PR comments
I plan to fix the missing comment issue when I add the
convert-jsdoc-types-to-typescript-types refactoring. Or at least work
around it.
2017-09-21 09:44:51 -07:00
Nathan Shively-Sanders
ae87db7b3e getAdjustedStartPosition shouldn't skip to next line when on 1st line 2017-09-20 16:26:46 -07:00
Andy
d96dfeb708 Don't normalize whitespace in fourslash tests (#18447)
* Don't normalize whitespace in fourslash tests

* Only render whitespace when the diff is text-only
2017-09-14 08:23:50 -07:00
Andy
ed4e2e6e3b Ensure that emitter calls callbacks (#18284)
* Ensure that emitter calls calbacks

* Move new parameter to end of parameters

* Fix for ConditionalExpression

* Make suggested changes to emitter

* Fix parameter ordering

* Respond to minor comments

* Remove potentially expensive assertion

* More emitter cleanup
2017-09-07 14:30:19 -07:00
Andy
53b5abe5bb Update fromCodeFixContext (#18290) 2017-09-07 07:19:00 -07:00
Basarat Ali Syed
c4dd820564 export interfaces used by exported functions 🌹 2017-08-15 15:19:40 +10:00
Ryan Cavanaugh
12403d9f70 Various fixes 2017-08-10 13:07:42 -07:00
Ryan Cavanaugh
c7f665faa1 Extract Method (squash) 2017-08-04 16:10:33 -07:00
Andy
e7dc2a67ca Enable "object-literal-shorthand" lint rule (#16987) 2017-07-07 07:26:58 -07:00
Arthur Ozga
4e6e1d1b8b Merge pull request #16657 from aozgaa/formatOnOpenCurly
Format on open curly
2017-06-30 10:04:57 -07:00
Andy
9013665e22 Replace FileMap with Map where there is no keyMapper (#16724)
* Replace FileMap with Map where there is no keyMapper

* Remove `toKey` and use `keyMapper` directly
2017-06-28 13:15:34 -07:00
Arthur Ozga
61af315778 respond to comments 2017-06-26 10:55:04 -07:00
Andy
24d98f2295 Merge pull request #15856 from Microsoft/jsdoc
Support for JSDoc in services
2017-05-22 07:46:52 -07:00
Ryan Cavanaugh
f6fbe61718 Refactoring support (squash) 2017-05-19 10:45:49 -07:00
Andy Hanson
dc40f5d6b9 Merge branch 'master' into jsdoc 2017-05-17 07:17:32 -07:00
Andy Hanson
38784b761a Support for JSDoc in services 2017-05-15 14:45:30 -07:00
Arthur Ozga
62dbf12825 Merge branch 'master' into typeToStringViaTypeNode 2017-05-12 13:09:43 -07:00
Yui
a1a2006074 Merge pull request #15160 from Microsoft/master-jsxChildren
[Master] Type checking JSX children
2017-04-21 10:02:13 -07:00
Arthur Ozga
cddccf1f43 Merge branch 'master' into typeToStringViaTypeNode 2017-04-19 10:48:38 -07:00
Arthur Ozga
cbbf6f8847 Merge branch 'master' into tripleEquals 2017-04-17 15:57:51 -07:00
Kanchalai Tanglertsampan
4fa23127fc Fixing consuming whitespace in children 2017-04-12 12:08:12 -07:00
Ryan Cavanaugh
e3bb5d3f28 Update linting to avoid typechecking for booleanTriviaRule 2017-04-04 22:34:51 -07:00
Arthur Ozga
7e03429a8e enforce triple-equals 2017-04-04 15:51:13 -07:00
Arthur Ozga
7e2517975c Basic functionality
* pass context as argument in xToNode methods
* make sourcefile optional in printer
* start consolidating NodeBuilderFlags and TypeFormatFlags
2017-03-30 14:14:15 -07:00
Arthur Ozga
4329b4524e Cleanup 2017-03-27 12:01:56 -07:00
Arthur Ozga
7340c4ca1e type predicate support 2017-03-27 11:53:44 -07:00
Arthur Ozga
82bd05bbc0 Merge branch 'master' into createTypeNode 2017-03-23 16:29:00 -07:00
Arthur Ozga
c4ddc5bffa Respond to more comments 2017-03-22 12:54:51 -07:00
Arthur Ozga
d3661f5b6a add tokenVisitor 2017-03-17 13:55:39 -07:00
Andy Hanson
2305c10a65 Fix lint errors 2017-03-17 13:54:18 -07:00
Arthur Ozga
a4b981af16 Merge branch 'master' into createTypeNode 2017-03-15 13:06:35 -07:00
Vladimir Matveev
2b10611fbf initial revision of infrastructure to produce text changes that uses existing node factory, formatter and printer (#14441)
initial revision of infrastructure to produce text changes that uses existing node factory, formatter and printer
2017-03-15 11:44:36 -07:00
Arthur Ozga
8020e24fda Merge branch 'vladima/textChanges' into createTypeNode 2017-03-14 18:40:39 -07:00
Vladimir Matveev
323aa3a56c add asserts for cases when containing list cannot be determined 2017-03-14 17:17:16 -07:00
Vladimir Matveev
5775d27e32 respect initial order of changes 2017-03-14 17:08:35 -07:00
Arthur Ozga
18723d938f Merge branch 'vladima/textChanges' into createTypeNode 2017-03-14 16:46:09 -07:00
Vladimir Matveev
d4bb267ee3 add insertNodeInListAfter functionality 2017-03-14 16:13:33 -07:00
Arthur Ozga
27fe2df203 some missed token bugs 2017-03-13 20:20:26 -07:00
Zhengbo Li
c46a2e7e1b always create new node array when assigning positions 2017-03-13 12:45:28 -07:00
Arthur Ozga
f0b4efe94f type literals, properties only 2017-03-13 09:18:40 -07:00
Vladimir Matveev
d7e62bb9f7 initial revision of infrastructure to produce text changes that uses existing node factory, formatter and printer 2017-03-03 13:50:58 -08:00