Commit graph

54 commits

Author SHA1 Message Date
Andy dce6668070
Change pathCompletions to stringCompletions, move more code there (#28245) 2018-10-30 22:01:31 -07:00
Andy 437bc41e99
For path completions, include extension as a kindModifier (#28148) 2018-10-30 11:56:34 -07:00
Andy 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
Ron Buckton dc5cd9676b Switch to paths-like pattern matching 2018-08-28 09:33:03 -07:00
Ron Buckton 6f7a37c99a Added fourslash test 2018-08-20 17:44:34 -07:00
Ron Buckton 015babb6f7 Initial support for 'typesVersions' 2018-08-20 16:57:18 -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 cb9c3e0f6a
Don't provide a path completion if a directory name was already typed (#25055) 2018-06-22 11:18:16 -07:00
Andy 5983c45e24
Fix typo: seperate -> separate (#24338)
* Fix typo: seperate -> separate

* update tests
2018-05-23 09:36:17 -07:00
Andy e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Sheetal Nandi 92296b34dd Rename 2018-05-07 12:14:53 -07:00
Sheetal Nandi e8cd6b1111 Suggest json files in completion when resolveJsonModule is set and module resolution is node
Fixes #23899
2018-05-04 17:10:48 -07:00
Ron Buckton 1dff0af646 More path cleanup 2018-05-01 18:53:54 -07:00
Andy 70682b7799
Clean up code for nonrelative path completions (#23150)
* Clean up code for nonrelative path completions

* Remove unnecessary test and simplify based on that

* More code review

* Call getCompletionEntriesFromTypings unconditionally
2018-04-06 12:19:08 -07:00
Andy 6ef4d7774a
Always test replacementSpan, and don't provide if it would just be an identifier (#22918) 2018-03-27 15:15:50 -07:00
Andy a564912d9a
Apply 'no-unnecessary-qualifier' lint rule (#22009) 2018-03-01 14:20:18 -08:00
Andy d35d5d0793
Fix bug: Check for both "./" and ".\" (#21730)
* Fix bug: Check for both "./" and ".\"

* Use normalizeSlashes
2018-02-07 10:50:49 -08:00
Andy c1b4c5b827
Fix bug in normalizeAndPreserveTrailingSlash: For "./", return "", not "/" (#21704) 2018-02-07 09:07:05 -08:00
Andy a1ffa9478c
Fix ScriptElementKind for path mapping completions (#21695) 2018-02-06 13:42:32 -08:00
Andy ba1833759f
Simplify string literal completions (#21415) 2018-02-06 12:31:34 -08:00
Andy cd22ea73d3
Remove leading directory separator from path mapping completion (#21688) 2018-02-06 11:39:09 -08:00
Andy cde1cd0075
Add top-level completion for path mapping (#21686) 2018-02-06 11:17:06 -08:00
Andy 1784e51929
Fix harness getDirectores implementation to not include directory as prefix (#21633) 2018-02-05 11:11:00 -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
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
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 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 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 a33f229d82
Support completions contextual types in more places (#20768)
* Support completions contextual types in more places

* Adjust formatting
2018-01-03 13:51:33 -08:00
Andy 43a35bad2e
Miscellaneous fixes to avoid duplicate completions (#20349)
* Miscellaneous fixes to avoid duplicate completions

* Move typeHasCallOrConstructSignatures to utility
2017-11-30 09:36:17 -08:00
Andy bd2e97597d
Enable 'no-empty' tslint rule (#19769)
* Enable 'no-empty' tslint rule

* Fix bug
2017-11-07 09:22:28 -08:00
Ron Buckton 31c3d444f1 Merge branch 'master' into compareStrings 2017-11-03 23:01:51 -07:00
Andy 1d7f449a87
Minor cleanups in pathCompletions.ts (#19685)
* Minor cleanups in pathCompletions.ts

* Update name
2017-11-03 15:06:22 -07:00
Andy 749e151c23
Support path completions inside node_modules (#19692)
* Support path completions inside node_modules

* Fix: Start searching from current file's directory, not host.getCurrentDirectory()

* Add test for nested node_modules

* Also test in /src/folder/b.ts
2017-11-03 15:05:44 -07:00
Ron Buckton bfba32b71d Cleanup, merge #19475 2017-10-26 13:49:32 -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
Sheetal Nandi e30a66d22f Add utitlity for stringContains 2017-10-10 17:16:39 -07:00
Andy 30d973bdcb Rename symbol.name to escapedName and make name unescaped (#17412) 2017-07-25 14:22:26 -07:00
Andy eadd084c82 Add 'name' property to Identifier (#17329)
* Add 'name' property to Identifier

* Rename to unescapedText

* Rename 'id.text' to 'id.escapedText'

* Rename 'id.unescapedText' to 'id.text'

* Make escapeIdentifier and unescapeIdentifier do nothing
2017-07-25 13:16:34 -07:00
Andy 08030c7d02 Convert most of core.ts to accept ReadonlyArray (#17092)
* Convert most of core.ts to accept ReadonlyArray

* Fix lint

* Fix isArray
2017-07-11 17:39:33 -07:00
Andy 23da0ab501 Use array helpers in more places (#17055) 2017-07-11 09:00:34 -07:00
Wesley Wigham 4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Andy Hanson b1e100e494 Merge branch 'master' into kind 2017-05-23 07:02:30 -07:00
Arthur Ozga 567b10d71c Merge pull request #15545 from aozgaa/atTypesPrefixAndImportSuffix
At types prefix and import suffix
2017-05-22 16:53:04 -07:00
andy-ms b162097c3c Make ScriptElementKind and HighlightSpanKind string enums 2017-05-20 07:56:24 -07:00
Andy Hanson 38784b761a Support for JSDoc in services 2017-05-15 14:45:30 -07:00