3825 Commits

Author SHA1 Message Date
Andrew Branch
3e824f18a8
Don’t offer non-relative non-paths path when baseUrl is undefined (#40813) 2020-09-28 12:06:39 -07:00
Alex T
73f5f02e97
fix(40756): disable truncation for inferred type (#40764) 2020-09-25 13:01:08 -07:00
Alex T
8e86b24036
feat(40233): add JS Doc types to smart selection (#40338) 2020-09-25 12:36:04 -07:00
Alex T
78830f3be2
fix(40510): add element access expressions support in convertToOptionalChainExpression (#40524) 2020-09-22 18:17:17 -07:00
Andrew Branch
9eb6424b8f
Fix indentation of arrow functions returning parenthesized expressions (#40677)
* Fix indentation of arrow functions returning parenthesized expressions

* Add more test cases
2020-09-22 17:16:09 -07:00
Alex T
6c6ddfe5c0
fix(39899): include in NavigationBar default exported call expression arguments (#40412) 2020-09-18 13:06:56 -07:00
Alex T
d779a19053
fix(40432): show as keyword in function context (#40481) 2020-09-17 02:15:48 -07:00
Ron Buckton
dba042d7d5
Add quick fix to add 'void' to Promise resolved without value (#40558)
* Add codefix to add 'void' to Promise resolved without value

* Add specific error message in checker to reduce quick-fix time in editor
2020-09-14 19:12:33 -07:00
Andrew Branch
575baf5c7f
Support auto-import from paths alias without baseUrl (#40546) 2020-09-14 15:23:47 -07:00
Alex T
c493d077a3
copy prologue directives to new file (#40306) 2020-09-14 12:24:32 -07:00
Ryan Cavanaugh
ea51fabb7c
Don't crash when observing invalid 'export' in object literal (#40295)
Fixes #32870
2020-09-11 17:18:23 -07:00
Alex T
d7cd405bb2
feat(14751): show static members at the top of the list for a class like completion (#40428) 2020-09-11 14:48:24 -07:00
Orta Therox
db5368dc1d
Import the semantic highlighter from typescript-vscode-sh-plugin (#39119)
* Initial import of the vscode semantic highlight code

* Adds the ability to test modern semantic classification via strings instead of numbers

* Adds existing tests

* Port over the semantic classification tests

* Update baselines

* Update src/harness/fourslashImpl.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Handle feedback from #39119

* Consistent formatting in the 2020 classifier

* Update baselines

* Apply suggestions from code review

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/harness/fourslashImpl.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Reafactor after comments

* Use 2020 everywhere

* Handle feedback

* WIP - don't provide a breaking change

* Fix all build errors

* Update baselines

* Update src/services/classifier2020.ts

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Addresses Ron's feedback

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-09-11 15:10:55 -04:00
Orta Therox
0a5f53301f
Retains trailing cmments in a logical manner in extract type (#40245) 2020-09-10 14:59:46 -04:00
Nathan Shively-Sanders
e350c357d2
Alias for module.exports.x = x (#40228)
* Alias for `module.exports.x = x`

This fixes #40155 in a surprisingly small amount of code.

* Treat any aliasable expression as an alias

* test internal references to exported class
2020-09-10 11:23:48 -07:00
Nathan Shively-Sanders
156cb4c1f9
Fix see tag quickinfo (#40458)
* Add test

* Treat see tags same as param tags
2020-09-10 08:28:38 -07:00
Vincent Boivin
96b0832cf6
fix(40322): bad completions for string literal type as indexed access type object (#40424)
* Added fourslash tests to work on the bug

* fix(40322): bad completions for string literal type as indexed access type object

* Added regression tests

* Using nodes instead of text

* Add verification for parenthesized nodes

* Using range check

* Change test markers
2020-09-09 15:26:35 -07:00
Wenlu Wang
ee5f51bc0f
Add see tag support (#39760)
* Add see tag parser

* add baseline

* fix symbol resolve

* add more case

* fix unittests

* improve tests and parser

* accept baseline

* Adopt package-lock.json and npm ci

* Add a workflow to update package-lock.json daily

* Git ignore package-lock.json and forcibly update in workflow

* Update bot email address

* Delete extra npm update

* Update package-lock.json

* Add compactDisplay and signDisplay to NumberFormatOptions (#40039)

* Fix typo in (Readonly)Set.keys comment (fixes #40164) (#40176)

* fix(26325): use a unique name for reserved words in 'constructor like' function name (#39684)

* fix(25770): add diagnostic message for the possible mapped type used as an index (#39973)

* fix(31046): add new diagnostic message for incompatible constructor signature (#40073)

* Update package-lock.json

* Update package-lock.json

* Add rename support

* Accpet baseline

* wip

* fix anders

* Revert "fix anders"

This reverts commit b3178d46184c068b7b83008ad98a52faac1e8a34.

* Fix call hierarchy item serialization and server tests (#40348)

* Avoid error

* accept baseline

* Add more tests

* Add signature name resolve

Co-authored-by: Andrew Casey <andrew.casey@microsoft.com>
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
Co-authored-by: Neil Kistner <neil.kistner@gmail.com>
Co-authored-by: cherryblossom000 <31467609+cherryblossom000@users.noreply.github.com>
Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com>
Co-authored-by: Erich Gamma <egamma@microsoft.com>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-09-09 10:45:09 -07:00
Alex T
4584d6d470
fix(39676): skip removing unused parameters for functions used as callback references (#40299) 2020-09-09 08:23:53 -07:00
Alex T
6aec7f4676
feat(25770): add Quick Fix to convert LiteralType to MappedType (#40226) 2020-09-08 14:18:53 -07:00
Andrew Branch
f6f2d36ee3
Add optionalReplacementSpan to completions response (#40347)
* Add optionalReplacementRange to completions response

* Get the name right

* Fix unit tests

* Fix comment typo

* Fix comment typo

* Baseline
2020-09-04 13:09:52 -07:00
Alexander T
8384018e68
fix(26141): show completions for string parenthesized types (#39697) 2020-09-04 12:15:16 -07:00
Andrew Branch
8ffb7f083d
Reprioritize cross-project module specifier suggestions for auto-import (#40253)
* Add test

* Suggest `paths` module specifiers even when a node_modules path was available

* Fix some tests

* Fix remaining tests

* Add comments
2020-09-03 14:00:06 -07:00
Alexander T
db5f519514
fix(31126): show completions in nested namespace name (#39663) 2020-09-03 13:32:03 -07:00
Alexander T
38cedc5b5f
fix(39410): don't remove variables with type definition during converting named export to default (#39505) 2020-09-02 17:00:43 -07:00
Andrew Branch
838a5e6044
Fix call hierarchy item serialization and server tests (#40348) 2020-09-02 11:34:14 -07:00
Andrew Branch
7a0f603b11
Fix extract symbol crash on unterminated literals; don’t offer to extract export = ... (#40272)
* Don’t offer to extract export assignment

* Terminate unterminated literals when extracting them

* Add test with regular expression ending in backslash

* Add test for string literal ending in backslash

* Remove unused parameter default
2020-08-31 14:17:09 -07:00
Andrew Branch
bfb00eb164
Fix misplaced comma in auto imported specifier (#40273) 2020-08-31 10:54:53 -07:00
Alexander T
01362a3ac1
feat(part of 40169): add spelling suggestion/quick fix for module/namespace exported members (#40211) 2020-08-29 01:01:06 -07:00
Alexander T
fa5e9807e8
fix(40010): add outlining for comments before variables statements (#40016) 2020-08-27 16:29:05 -07:00
Alexander T
9f3af67929
fix(10019): allow renaming labels (#40064) 2020-08-18 01:04:49 -07:00
Nathan Shively-Sanders
c3d41bbb73
Alias for commonjs require in JS (#39770)
* First attempt at aliases for require

* test+initial support for const x=require

* 1st round of baseline improvements

* 2nd round of baseline updates

* support property access after require

* check @type tag on require

* forbid expando missing namespaces on aliases

taken from #39558 as soon as it was created

* accept error baselines that are good, actually

* Scribbling on d.ts emit code

* use getSpecifierForModuleSymbol

* hideous hack for module.exports of aliases

* Fix module.exports.x --> export list emit

* fix isLocalImport predicate

* require only creates aliases in JS

* re-handle json imports

* update fourslash baseline

* Cleanup in the checker

1. Simplify alias resolution.
2. Simplify variable-like checking.
3. Make binding skip require calls with type tags -- they fall back to
the old require-call code and then check from there.

I haven't started on the declaration emit code since I don't know what
is going on there nearly as well.

* Function for getting module name from require call

* First round of cleanup plus a new test

Found one missing feature, not sure it's worth adding.

* more small cleanup

* more cleanup, including lint

* use trackSymbol, not serializeTypeForDeclaration

* Code review comments, plus remove unneeded code

Ad-hoc type reference resolution for `require` isn't needed anymore.

* find all refs works

* remove old ad-hoc code

* make it clear that old behaviour is not that correct

* update api baselines

* remove outdated comment

* PR feedback

1. Fix indentation
2. Add comment for exported JSON emit
3. Add test case for nested-namespace exports.

* add a fail-case test (which passes!)
2020-08-17 14:00:37 -07:00
Zen
0ed523bb60
fix jsx completions after attributes (#39859)
closes #39530
2020-08-13 16:14:12 -07:00
Eli Barzilay
620e260576 Avoid the double-symbol trick for enums
Nameless jsdoc typedefs have their exportedness controlled by the
exportedness of the location they pull their name from.

Fixes #33575.
2020-08-12 18:40:57 -04:00
Wenlu Wang
57e2fe0462
Improve deprecated suggestion node position (#39702)
* Improve deprecated suggestion node position

* fix typo

* Simplify code

* merge helper function
2020-08-10 17:37:11 -07:00
Nathan Shively-Sanders
3328fdb2d8
Use isUncalledFunctionReference for aliases too (#39950)
* Use isUncalledFunctionReference for aliases too

Fixes bogus deprecated notices on imports of functions with deprecated
overloads, but with some non-deprecated overloads.

Fixes microsoft/vscode#104238

* Just check all declarations, don't call isUncalledFunction
2020-08-07 10:07:55 -07:00
Jesse Trinity
91a7c359b3
Insert auto imports after header comment (#39924)
* place first import after header

* don't insert before non-header
2020-08-06 13:33:29 -07:00
Andrew Branch
7f4e1b699a
Find tagless JSDoc as preceding token (#39912) 2020-08-05 10:09:45 -07:00
Nathan Shively-Sanders
c9f05af2c8
Merge pull request #37891 from Neonit/jsDocIndentationPreservation
Fix indentation preservation in JSDoc (#37717)
2020-08-04 16:09:50 -07:00
Orta Therox
faf128de15
Fix formatting scanner on JSX text that looks like trivia (#39718)
* Fix formatting scanner on JSX text that looks like trivia

* Combine if statements

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-07-30 13:56:14 -04:00
Sheetal Nandi
48e58f44db
Handle unresolved baseType when trying to get completions for static member (#39731)
* Handle unresolved baseType when trying to get completions for static member
Fixes  #38067

* Update src/services/completions.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* correct the condition

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-07-24 16:37:28 -07:00
Andrew Branch
ec33814616
Make AutoImportProviderProject work with symlinked monorepos (#39679)
* Hack everything together

* Add test

* Remove realpath from program

* Ensure symlinked directories are directories

* Revert unnecessary change

* Update baselines

* Use host program realpath on AutoImportProviderProject files before program creation

* Which fixes hasRoots() too

* Apply suggestions from code review

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Lint

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-07-22 13:53:30 -07:00
Andrew Branch
b834096998
Fix emit/formatting issues in refactors (#39506)
* Fix #37948

* Fix formatter skipping tab/space fixup on comments, handle trailing commas in list closing line count.

Fixes #37944

* Add newline between imports and main body of new file in moveToNewFile

Fixes #37941

* Update baseline (probably broken before?)
2020-07-22 10:31:42 -07:00
Song
e76d17257a
Fix 38219: signature helper works for optional function condition. (#39672)
* fix optional fuction condition.

* Adds a test

Co-authored-by: Orta <git@orta.io>
2020-07-22 12:30:21 -04:00
Song
294a0406e3
not escape unicode char for import path string. (#39463)
* not escape unicode char for import path string.

* fix test.
2020-07-22 11:28:29 -04:00
Song
d897646a4a
fix 39453 (#39579)
* fix 39453

* add restriction.

* add tests

* comment.

* fix as suggestion.
2020-07-21 09:40:25 -07:00
Alexander T
6430211f8f
fix(38868): add separator for type parameters (#39621) 2020-07-16 10:58:16 -07:00
Wenlu Wang
fcd4fcb3d7
Use combined node flags (#39403) 2020-07-15 09:22:12 -07:00
Wenlu Wang
7b728754c0
Fix incorrect deprecated mark (#39611)
* Fix incorrect deprecated mark

* improve test
2020-07-15 08:47:25 -07:00
Alexander T
ececf3b0a7
fix(33511): show jsx namespace default import quick fix if it does not exists in the current scope (#38419) 2020-07-14 15:43:18 -07:00