Commit graph

151 commits

Author SHA1 Message Date
Ryan Cavanaugh 69f73eba16 Return mapped locations in alternate fields 2018-05-11 17:22:10 -07:00
Andy 7271ec1240
Add 'move to new file' refactor (#23726)
* Add 'move to new file' refactor

* Code review, and support commonjs

* Compute movedSymbols completely before using, and support `export import`

* Fix assertion error: sort empty change before non-empty change

* Remove extra newline

* Add allowTextChangesInNewFiles preference

* Add the new file to 'files' in tsconfig

* Avoid parameter initializer

* Update API baselines

* Use path relative to tsconfig.json

* Code review

* Fix error where node in tsconfig file was missing a source file
2018-05-10 11:17:04 -07:00
Andy ddf20ecd6d
Support '.' as a trigger character (#23890)
* Support '.' as a trigger character

* Add a CompletionsTriggerCharacter type

* Add more trigger characters

* Add another type CompletionsTriggerCharacter

* Update API baselines
2018-05-08 09:52:46 -07:00
Ryan Cavanaugh ffa0ccba2a Project References Core support 2018-05-07 15:12:50 -07:00
Andy 2604bb4dd3
Add 'string' ScriptElementKind (#23821) 2018-05-07 12:39:00 -07:00
Mohamed Hegazy 3bc3f2d404 Add comments to kinds 2018-05-05 12:38:59 -07:00
Mohamed Hegazy 8072dae16b Change kind name to imports 2018-05-05 12:02:40 -07:00
Mohamed Hegazy f1713c92d3 Add outlining spans for import declarations 2018-05-04 10:39:47 -07:00
Mohamed Hegazy e52efb04f3 Fix #22419: Add kind field to OutliningSpan 2018-05-03 16:28:55 -07:00
Andy bcb5599bf2
Fix typo (#23725) 2018-04-26 16:18:47 -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
Andy 22f2b118b7
Add 'triggerCharacter' option for completions requests (#23491)
* Add 'triggerCharacter' option for completions requests

* mhegazy code review

* More code review

* Handle '<' in comment
2018-04-20 10:25:58 -07:00
Andy ff7ef4a25a
Add fixName property to CodeFixAction (#23350) 2018-04-12 09:05:30 -07:00
Andy 4b706fc479
Add 'disableSuggestions' to UserPreferences (#23283)
* Add 'disableSuggestions' to UserPreferences

* Make mergeMapLikes return a new object

* Avoid additional clone

* mergeMapLikes -> object spread
2018-04-10 11:53:24 -07:00
Andy 1e227c6d77
Add type predicate helper functions to Type (#23066) 2018-04-04 08:10:09 -07:00
Arthur Ozga 95a69cbeb4 Merge branch 'master' into dev/aozgaa/cSharpObjLiteralFormatting 2018-03-29 16:10:33 -07:00
Arthur Ozga 5fb5ff7bf3 add option for object literal indent 2018-03-29 15:40:23 -07:00
Andy 3e32e15895
Add 'fixAllDescription' property to CodeFixAction (#22616)
* Add 'fixAllDescription' property to CodeFixAction

* Code review

* Add to protocol

* Make fixAllDescription be just a string
2018-03-27 18:21:21 -07:00
Wesley Wigham 6af764c560
Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Andy cc3921323c
Support services settings (#22236)
* Support services settings

* Code review

* More review

* Use different names for Options and GetCompletionsAtPositionOptions (todo: come up with better names)

* More renames

* More renaming

* Support quote style in importFixes

* Add `importModuleSpecifierPreference` option

* Support quote style for `throw new Error('Method not implemented.')` (#18169)

* options -> preferences
2018-03-20 13:07:59 -07:00
Andy fa4619c5c1
Add 'info' diagnostics (#22204)
* Add 'info' diagnostics

* Code review
2018-02-28 11:16:32 -08:00
Andy 4f309702c1
Separate isGlobalCompletion from CompletionKind (#22074)
* Separate isGlobalCompletion from CompletionKind

* Fix comments
2018-02-21 13:12:13 -08:00
Andy 8e078b9fde
Add comment to isGlobalCompletion (#21973) 2018-02-16 16:48:42 -08:00
Andrew Casey 5656f35b6a Introduce an organizeImports command
In phase 1, it coalesces imports from the same module and sorts the
results, but does not remove unused imports.

Some trivia is lost during coalescing, but none should be duplicated.
2018-02-16 10:51:38 -08:00
Andy 1784e51929
Fix harness getDirectores implementation to not include directory as prefix (#21633) 2018-02-05 11:11:00 -08:00
Andy f96dc84a70
Make getCombinedCodeFix API public (#21234) 2018-01-17 12:42:31 -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
Wenlu Wang 7154df10df add support for insertSpaceBeforeTypeAnnotation (#20466) 2018-01-08 13:25:02 -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
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 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 fd4d8ab96e
Support a 'recommended' completion entry (#20020)
* Support a 'recommended' completion entry

* Code review

* Restore duplicate comments
2017-12-01 13:00:01 -08:00
Wesley Wigham 5ee640d2b6
Move utilities for getting type parameter constraints and defaults from public lazy members to services (#20162) 2017-11-28 13:37:42 -08:00
Andy e7adb1ce79
Bundle fileName with CodeActionCommand (#19881)
* Bundle fileName with CodeActionCommand

* Update test

* Fix API tests

* Add new overloads in services

* Fix overload

* Update API baselines
2017-11-17 14:16:38 -08:00
Andy b94940525b
Allow applyCodeActionCommand to take an array (#19870)
* Allow applyCodeActionCommand to take an array

* Use this.host.newLine
2017-11-09 13:17:47 -08:00
Andy 77b24aec83
Apply 'unified-signatures' tslint rule (#19738)
* Apply 'unified-signatures' tslint rule

* Fix new failure
2017-11-06 18:38:03 -08:00
Sean Barag a46d2705ef Use documentation comments from inherited properties when @inheritDoc is present (#18804)
* Use documentation comments from inherited properties when @inheritDoc is present

The JSDoc `@ineheritDoc` [tag](http://usejsdoc.org/tags-inheritdoc.html)
"indicates that a symbol should inherit its documentation from its
parent class".  In the case of a TypeScript file, this also includes
implemented interfaces and parent interfaces.

With this change, a class method or property (or an interface property)
with the `@inheritDoc` tag in its JSDoc comment will automatically use
the comments from its nearest ancestor that has no `@inheritDoc` tag.
To prevent breaking backwards compatibility,
`Symbol.getDocumentationComment` now accepts an optional `TypeChecker`
instance to support this feature.

fixes #8912

* Use ts.getJSDocTags as per @andy-ms 's recommendation

* Convert @inheritDoc tests to verify.quickInfoAt

* Concatenate inherited and local docs when @inheritDoc is present

* Make typeChecker param explicitly `TypeChecker | undefined`

* Re-accept baseline after switch to explicit `| undefined`

* Update APISample_jsodc.ts to match new getDocumentationComment signature

* Re-accept baselines after rebasing
2017-11-06 13:18:21 -08:00
Andy bb7fb7dda9
For getCompletionsAtPosition, require a flag to provide completions with code actions (#19687)
* For getCompletionsAtPosition, require a flag to provide completions with code actions

* Change name

* Increase API version

* Update API baselines

* Add comment

* Update API baseline
2017-11-03 15:55:31 -07:00
Andy f67a9ba96e
Apply 'interface-name' lint rule (#19695) 2017-11-02 17:20:18 -07:00
Armando Aguirre d5c18a6fb7
Merge branch 'master' into AddDefinitionAndBoundSpan 2017-10-30 17:02:23 -07:00
Andy 277e3189c2 Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional (#19507)
* Make getCompletionEntryDetails and getCompletionEntrySymbol parameters non-optional

* Increment servicesVersion

* Update api baselines
2017-10-30 15:10:34 -07:00
Andy 9615e54e13 Support multiple completions with the same name but different source module (#19455)
* Support multiple completions with the same name but different source module

* Use optional parameters for source

* Simplify use of `uniques`

* Update test

* Fix `undefined` error
2017-10-26 08:22:17 -07:00
Armando Aguirre ae266f6aa1 Merge branch 'master' into AddDefinitionAndBoundSpan 2017-10-24 11:18:07 -07:00
Sheetal Nandi 8fc651870e Merge pull request #19306 from Microsoft/doNoWriteFilesMultipleTimes
Fixes the issue with emit where in same file is emitted multiple times
2017-10-18 16:12:36 -07:00
Andy 0f55f4a701 Use Promise instead of PromiseLike (#19305) 2017-10-18 16:04:42 -07:00
Wesley Wigham 75a687b524 make getCurrentDirectory required (#19303) 2017-10-18 14:57:18 -07:00
Sheetal Nandi 8fbfb5ffc0 Modify api to emit affected files using callback instead of generating in memory output
Also marking few apis introduced during watch improvements changes that are suppose to be internal for now
2017-10-18 13:34:13 -07: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
Armando Aguirre b86153da88 Changed command designed based on review input 2017-10-16 17:50:35 -07:00