Commit graph

870 commits

Author SHA1 Message Date
Matt Bierner
4a053c9d6d Extract server spanwer to own file 2019-06-20 17:11:20 -07:00
Matt Bierner
ccf4a04d5a extract server error to own file 2019-06-20 17:11:20 -07:00
Matt Bierner
7e1f8d4f1d Extract ITypeScript server interface 2019-06-20 17:11:20 -07:00
Matt Bierner
8b93c01655 Re-queue canceled geterr requests before remaining buffers
We should give higher priority to files that have previously had geterr triggered on them but did not have their request completed
2019-06-20 10:27:36 -07:00
Matt Bierner
459939b905 Provide full TS symbol range when previewing definitions in VSCode
Fixes #72017

Has two fixes:

- Hooks up the JS/TS extension to consume the full symbol range provided by https://github.com/microsoft/TypeScript/pull/31587

- Makes the go the definition mouse implementation use the locationLink to compute the preview range. If a`targetSelectionRange` is provided, this means we use the normal `range` to get the preview range
2019-06-17 15:39:56 -07:00
Lee Houghton
fa4f870501
Handle multiple users with /tmp/vscode-typescript
This fixes an issue where the typescript language server fails to load if multiple users launch VS Code on the same Linux machine.

Steps to reproduce:
- Log in as user1
- Launch VS Code
- Log out
- Log in as user2
- Launch VS Code
- It tries to write to files in /tmp/vscode-typescript, but that directory is not writeable because it is owned by user1
- You cannot use TypeScript intellisense

This fix namespaces the directory with the current uid so that each user will get their own. 

On Windows, this shouldn't be an issue anyway since each user gets their own temp directory.
2019-06-15 00:36:23 +01:00
Matt Bierner
e3294dc7b1 Fix exception if extension is not installed 2019-06-14 16:30:05 -07:00
Matt Bierner
c419355b5b
Merge pull request #75375 from microsoft/dev/mjbvz/vscode-api-readonly-events
Mark events as readonly in VS Code api
2019-06-14 11:59:57 -07:00
Benjamin Pasero
c6d9e8ea64 status - push proposed API for statusbar id/name and adopt 2019-06-14 11:52:39 +02:00
Andrius
2ac8fbb7d0 notify tsserver about changes in external files. 2019-06-13 19:20:33 +03:00
Matt Bierner
b4f6130fe4 Fix some compile errors resutling from readonly change 2019-06-12 16:54:16 -07:00
Matt Bierner
a6a376e933
Merge pull request #75092 from microsoft/dev/mjbvz/readonly-diagnostics-api
Use readonly arrays for the vscode.DiagnosticCollection api
2019-06-12 14:46:17 -07:00
Matt Bierner
1f4e2a21fc Add support for loading contributed TS version
Fixes https://github.com/microsoft/vscode/issues/75222
Fixes https://github.com/microsoft/TypeScript/issues/31623
2019-06-10 15:42:35 -07:00
Matt Bierner
a1c33c6c12 Don't try creating untitled files in a refactoring
Fixes #75132
2019-06-10 11:11:12 -07:00
Matt Bierner
8448512143 Use readonly arrays for the vscode.DiagnosticCollection api
## Problem
The diagnostic collection object is set up so that it does not mutate the arrays of diagnostics you pass to it. It also does not expect or allow mutation of diagnostics that it returns.

However it it currently typed using normal arrays. This means that if an extension (such as JS/TS) wishes to use readonly diagnostics intnernally, it cannot do so without casting.

## Proposed Fix
Use `ReadonlyArray` in diagnostic collection. This should be a safe change for the `set` type methods. The changes to `get` and `forEach` have the risk of breaking the typing of some extensions, but `get` already returned a frozen array of diagnostic so trying to mutate the array itself would have resulted in runtime error.
2019-06-07 11:41:33 -07:00
Matt Bierner
dc2245f164 Use readonlyArray for diagnostics 2019-06-07 11:25:16 -07:00
Matt Bierner
dc8e21138f Extend disposable 2019-06-07 11:23:14 -07:00
Matt Bierner
69a7b7ef24 Extract areLanguageDiagnosticSettingsEqual 2019-06-07 11:22:06 -07:00
Matt Bierner
a87c73527e Remove extra work in DiagnosticSettings ctor
The langauges map is written so that it is lazy. We do not need to pre-populate it
2019-06-07 11:21:22 -07:00
Matt Bierner
5b01e094c2 Use includes instead of indexOf 2019-06-07 11:12:54 -07:00
Matt Bierner
809386b670 Working on getting ts server class in a testable state 2019-06-05 15:41:45 -07:00
Benjamin Pasero
d78a75973c
update @types/node (#74881) 2019-06-05 10:20:01 +02:00
Matt Bierner
76e774e4bd Add arrays.empty
This helps with `a === b` checks  in arrays.equals
2019-05-30 17:22:38 -07:00
Matt Bierner
015f1c7909 Use array prototype instead of creating instance 2019-05-30 17:13:10 -07:00
Matt Bierner
a8a0fa763f Use every for equals 2019-05-30 17:01:10 -07:00
Matt Bierner
55d6317a4f Don't update js/ts diagnostics if they have not changed
Fixes #74633

This was the indirect cause of  #74633. See that issue for an explaination of why it was problematic.  In summary, updating diagnostics can retrigger code actions even if the user facing diagnostics have not actually changed
2019-05-30 16:59:32 -07:00
Matt Bierner
c62a6aa38a Set extract kind for type alias refactoring
This lets you set up a single keybinding that applies to both extract constant and extract type
2019-05-29 14:22:45 -07:00
Matt Bierner
a9e31b19d7 Make sure we don't de-prioritize this. member suggestions
Fixes #74164
2019-05-23 16:06:34 -07:00
Matt Bierner
a4532de9af Make sure we reset editors being iterations of test 2019-05-23 16:06:34 -07:00
Matt Bierner
1db653c59e Simplify setting of preselect and sort text 2019-05-22 15:25:48 -07:00
Howard Hung
4582ec149c Fix typo: assigments -> assignments 2019-05-22 01:23:12 +08:00
Khaja Nizamuddin
36e7f1871a Normalize tsconfig path (#73001)
Fixes #68812
2019-05-21 04:01:54 -07:00
Matt Bierner
ada4bddb8e Change documentation for TS importModuleSpecifier.auto
Fixes #52485

Based on code in d53efdf380/src/compiler/moduleSpecifiers.ts (L139)
2019-05-17 18:14:40 -07:00
Matt Bierner
b1aad4b755 Supress potential null errors related to updated @types/node 2019-05-17 16:14:49 -07:00
Matt Bierner
12cf3eb0f8 Pick up latest TS@next 2019-05-17 13:39:55 -07:00
Logan Ramos
ca9887459b
Delete vscode-typescript upon close of VS Code (#73801)
* Cleans up vs-typescript temp directoy upon VS code close

* Fixed typing errors preventing build from succeeding

* Moved deletion to the deactivate method. Added folders per extension host

* Removed yarn watch script used in testing
2019-05-17 18:55:31 +00:00
Matt Bierner
fd1ac7561b Fix TS 3.5 compile errors
Fixing errors related to https://github.com/microsoft/TypeScript/issues/31380
2019-05-13 18:00:52 -07:00
Matt Bierner
60cd4bd73b
Merge pull request #73132 from hwhung0111/Fix
Fix two typos
2019-05-10 16:25:49 -07:00
kieferrm
c87ce98c9c fix gdpr annotation 2019-05-01 17:24:00 +00:00
Howard Hung
778b92f459 Fix typo in functionCallSnippet.test.ts 2019-05-01 23:35:02 +08:00
Matt Bierner
017a497259 spell 2019-04-24 11:01:35 -07:00
Matt Bierner
24ff03f627 Pick up ts 3.4.5 2019-04-23 10:50:51 -07:00
Matt Bierner
f56b18a9f7 Pass validateDefaultNpmLocation to ts 3.4.4
https://github.com/Microsoft/TypeScript/pull/30910/
2019-04-22 11:44:16 -07:00
Matt Bierner
a538f095af Organize imports should interupt geterr
UI operations like organize imports have higher priority than geterr
2019-04-22 11:44:16 -07:00
Matt Bierner
16944f3c4a
Merge pull request #72553 from tony-xia/makeRandomHexString
Update makeRandomHexString() to remove duplicate character
2019-04-22 10:57:16 -07:00
Tony Xia
697c8901a9 Update makeRandomHexString() to remove duplicate character 2019-04-18 23:20:45 +10:00
Tony Xia
941b4a9f79 Langauges -> Languages 2019-04-18 23:09:11 +10:00
Matt Bierner
e78a0ab37f Open TS Server logs in editor if possible
In most cases, were are only interested in the tsserver.log file, not the additional typings installer logs
2019-04-12 17:24:22 -07:00
Matt Bierner
cad3862663 Also include returned result count in completions telemetry 2019-04-12 14:43:14 -07:00
Sandeep Somavarapu
1fd2993b54 Fix #72185 2019-04-12 07:44:56 +02:00
Matt Bierner
222e2798ff Move min versions into jt/ts feature providers 2019-04-11 16:12:29 -07:00
Matt Bierner
9d43bdac05 Register features with Promise.all instead of sequentially 2019-04-11 16:00:46 -07:00
Matt Bierner
c6a9536ed7 Add telemetry for how long completions take in js/ts
We'd like to know the average time that it takes to return js/ts completions so that we can identify performance regressions. The time includes both the queuing time and the actual time spent executing the command against TS server
2019-04-11 16:00:46 -07:00
Matt Bierner
f635233740 Check in stubbed out smart select support for js/ts
For https://github.com/Microsoft/TypeScript/issues/29071

This require upstream TS support. Check in experimental support so that TS team can test the ux of this feature
2019-04-11 16:00:46 -07:00
Matt Bierner
d81145d3f0 Use proper documentHighlights api for html js intellisense 2019-04-10 15:21:53 -07:00
Matt Bierner
90c9650399 Handle invalid config file diagnostics from ts server
Fixes #72098
2019-04-10 15:21:53 -07:00
Matt Bierner
9d0a845b9e Better comment 2019-04-10 15:21:53 -07:00
Matt Bierner
2689d1b8b9 Add some pinning tests for indent 2019-04-10 15:21:53 -07:00
Matt Bierner
5d9377b42e
Merge pull request #71944 from vitaliymaz/fix-ts-confix-extends-navigation
fix link navigation to extended config file in tsconfig
2019-04-09 11:26:17 -07:00
Vitaliy Mazurenko
ea2ad14dde fix link navigation to extended config file in tsconfig 2019-04-09 10:15:14 +03:00
Matt Bierner
2538145dcd Auto indent jsx tags with attributes
Fixes #65955
2019-04-08 19:09:03 -07:00
Matt Bierner
0cf20c9b6d Better fix for #48735
Previous fix broke `reindent all lines` . New fix is only applied on enter and should handle bodies with multiple case better
2019-04-08 18:06:47 -07:00
Matt Bierner
88a6b2fb03 Auto indent case/default body for js/ts
Fixes #48735
2019-04-08 17:55:25 -07:00
Orta
3970010b52
Update README.md 2019-04-08 15:45:47 -04:00
Matt Bierner
80db6c43bd Treat updateOpen as a fence command 2019-04-03 14:43:37 -07:00
Matt Bierner
e50c2572d4 Also treat all unused imports as a style error
Fixes #71067
2019-04-02 17:15:53 -07:00
Matt Bierner
42f6d4648c Add trailing ... for command that opens a picker 2019-03-22 15:06:43 -07:00
Matt Bierner
f4921b0f20 Remove period from js/ts command title
Fixes #70961
2019-03-22 15:06:43 -07:00
Matt Bierner
1bccbd1cb6 Avoid sync stat call 2019-03-21 16:40:43 -07:00
Matt Bierner
4d81d14de0 Make updatePaths require TS 3.0+
Removes workarounds that were required to support this feature on TS 2.9.
2019-03-21 16:40:43 -07:00
Matt Bierner
25bfefce9e Make sure update imports handles js/ts directory moves
Fixes #62018
2019-03-21 16:40:43 -07:00
Matt Bierner
9517c8c565 Don't include TS prefix in ts task's error code field
Fixes #70572
2019-03-15 10:07:13 -07:00
Matt Bierner
e5463022e1 Show error if TS returns an empty refactoring
Fixes #70526

An empty refactoring response indicates that something went wrong
2019-03-14 17:58:07 -07:00
Matt Bierner
05efab0e4e Treat diagnostics recieved as js/ts init complete
Fixes #68896
2019-03-11 11:08:28 -07:00
Matt Bierner
36fb7647d7 Flush buffer changes if we see the same file again 2019-03-11 10:14:07 -07:00
Matt Bierner
0e6496dff8 Don't add change if there are no changes 2019-03-11 10:14:07 -07:00
Matt Bierner
0aa886c72e Add undocumented setting to disable batched sync 2019-03-11 10:14:07 -07:00
Matt Bierner
d597028001 Readonly 2019-03-11 10:14:07 -07:00
Matt Bierner
4b9c55d14e Don't leak knowledge that updateOpen is special 2019-03-11 10:14:07 -07:00
Matt Bierner
2a5d86952a Use TS's updateOpen api to batch file changes
For #64485

Batching file changes should be more efficent than sending requests one at a time.
2019-03-11 10:14:07 -07:00
Matt Bierner
2a2f817990 Use the updateOpen TS api to sync multiple changes in a single file
Fixes #69492
2019-03-06 14:54:40 -08:00
Matt Bierner
4bfec9c80f Make sure we match whole file name for config file 2019-03-06 10:50:09 -08:00
Matt Bierner
c93f5e3560 Use regular expression to identify config file names instead of singe file name 2019-03-06 10:50:09 -08:00
Matt Bierner
38c3f4bede Use config file diagnostics provided by TS Server
Fixes #69880
2019-03-05 17:07:14 -08:00
Matt Bierner
491dd0feb8 Add logging to see if TS buffers are in an invalid state
An example would be trying to change a file that is not opened
2019-03-01 16:06:51 -08:00
Matt Bierner
1cb65ce8e5 Extract and lift constant 2019-03-01 16:06:51 -08:00
Matt Bierner
29acd11312 Fix bad newline 2019-03-01 16:06:51 -08:00
Matt Bierner
553e6e4f79 Always clear diagnostics for a js/ts file when it closes
Fixes #59363
Fixes #58088
Reopens #47386
2019-02-21 10:45:43 -08:00
Matt Bierner
2e4d4a6bb1 Don't make extra reloadProjects call when a js/tsconfig files changes
The TypeScript Server should be watching these files already so we do not need to tell it to 'reloadProjects'. In the current case, 'reloadProjects' is causing a TS Server error

https://github.com/Microsoft/TypeScript/issues/30005

Fixes #68428
2019-02-20 16:59:35 -08:00
Matt Bierner
a2eee79774 Use 2018 as target for extensions since we are now running on node 10 2019-02-20 16:09:25 -08:00
Matt Bierner
ea995be36c Make sure we send correctly normalized stacks on errors 2019-02-14 14:33:56 -08:00
Matt Bierner
ba19df41ff Normalize stack 2019-02-14 14:33:56 -08:00
Matt Bierner
b819c7668e Remove jsDocCompletion setting
This has been renamed to `javascript.suggest.completeJSDocs` and `typescript.suggest.completeJSDocs`
2019-02-13 17:47:12 -08:00
Matt Bierner
b4522997ac Add preference to disable shorthand renaming
Fixes #68029

Use the `typescript.preferences.renameShorthandProperties` and `javascript.preferences.renameShorthandProperties` to disable shorthand property renames. Default to enabling renames
2019-02-13 17:44:08 -08:00
Matt Bierner
a8216d42a4 Make the typescript plugins contribution point dynamic
Part of #67575
2019-02-11 16:41:59 -08:00
Matt Bierner
1cb2f5500a Support TypeScript's explicit "auto" quotePreference
Fixes #68185
2019-02-07 17:31:25 -08:00
Matt Bierner
9a766eaa38 Make sure we update tag closing registration when the document's language changes
Fixes #67613
2019-01-30 18:50:41 -08:00
Matt Bierner
10c3fcb4fc Fixes #67430 2019-01-30 12:58:11 -08:00
Thai Pangsakulyanont
84424c84fd
Use jsonc parser to parse a config file
This fixes a problem where the `typescript` VSCode task runs `tsc` with `-p`
when it should run `-b` when `tsconfig.json` has the `"references"` property.

```js
{
  "extends": "./tsconfig.app.json",
  // meow
  "references": [{ "path": "./tsconfig.lib.json" }]
}
```

This bug happens because while `tsconfig.json` file allows comment, the
parsing logic here uses vanilla `JSON.parse` which cannot parse comments.

This commit fixes it by using `jsonc.parse` instead.
2019-01-30 17:46:45 +07:00
Greg Van Liew
6f1cb19909 Fix jSDocCompletion deprecation message 2019-01-29 10:51:13 -08:00
Matt Bierner
c37d497f2b Mark add missing async as auto fixable 2019-01-28 18:12:32 -08:00
Matt Bierner
13aff1eff2 Add workaround for TS not supporting providePrefixAndSuffixTextForRename not being supported per-file
Workaround for https://github.com/Microsoft/TypeScript/issues/29585
2019-01-28 17:16:49 -08:00
Matt Bierner
52fb9079e9
Merge pull request #67148 from RomainMuller/master
Fix the "tsc watch" task when references are used
2019-01-28 15:32:21 -08:00
Matt Bierner
b15877def6 Handle some edge cases of #18131 2019-01-28 14:46:29 -08:00
Matt Bierner
807759ecff Rename jsDocCompletion.enabled to javascript.suggest.completeJsDocs and typescript.suggest.completeJsDocs
Fixes #67146
2019-01-28 14:46:29 -08:00
Matt Bierner
a70b1317a1 Removing languageServiceEnabled check
After further discussion with the TS team, we determined that we do not need to stop sending  semantic commands when the language service disables itself
2019-01-28 13:40:27 -08:00
Matt Bierner
ef25b181ea Move ServerResponse into namespace 2019-01-28 13:40:27 -08:00
Matt Bierner
ccb5a625c2 Mark extract constant as a preferred refactoring
https://github.com/Microsoft/TypeScript/issues/29587
2019-01-28 13:40:27 -08:00
Matt Bierner
b36fddfc1f Experimentally marking a few more quick fixes as preferred 2019-01-25 11:48:25 -08:00
Matt Bierner
0927975565 Mark more quick fixes as preferred
#62110
https://github.com/Microsoft/TypeScript/issues/29450
2019-01-24 12:00:40 -08:00
Matt Bierner
4a39da971e Extend disposable in more places 2019-01-24 12:00:40 -08:00
Matt Bierner
e6f93f3074 Extract isPreferredFix 2019-01-24 12:00:40 -08:00
Matt Bierner
508f43166b Rename source.autoFix to source.fixAll
Part of #62110

`autoFix` is a confusing term since we have a `auto fix` command now. Using `fix all` as this term is used by many linters for this type of operation
2019-01-22 14:34:43 -08:00
Matt Bierner
73dfd92e65 Fix spelling 2019-01-22 14:34:43 -08:00
Matt Bierner
f929531dfb Add CodeActionKind.intersects
Fixes #66881
2019-01-21 18:04:01 -08:00
Matt Bierner
c994fc20fa Apply auto fix on save actions sequentially and make sure we request fixes of the specific type we are interested in 2019-01-21 17:16:06 -08:00
Matt Bierner
ee65a242a9 Gate auto fix for TS to use an undocumented experimental TS setting
We likely do not want to enable autofixes until we have proper TS support: https://github.com/Microsoft/TypeScript/issues/29452
2019-01-21 17:16:06 -08:00
Matt Bierner
4e6bd4aedd Prototype autofix source code action
Part of #62110

* Adds a new `CodeActionKind`: `source.autoFix`.
* Implements a simple auto fix provider for typescript. This provider can auto fix `implement interface` and `spelling` errors (provided there is only a single valid fix listed)

The provider is likely not something we actually want to check it (especially in its current state), we should ask TS for proper autoFix support
2019-01-21 17:16:06 -08:00
Matt Bierner
4f8d546aa7 De-duplicate "fix all" quick fixes across requests for multiple diagnostics in selection range
For https://github.com/Microsoft/typescript-tslint-plugin/issues/49
2019-01-21 17:15:49 -08:00
Romain Marcadier-Muller
ea59a710ca
Fix the "tsc watch" task when references are used
Moves the `--watch` option at the end of the `tsc` invocation, as `--build`
is required to be the first option on the call.

Fixes #66875
2019-01-21 17:14:11 -08:00
Matt Bierner
bcc2281e45 Rename CodeAction.canAutoApply -> CodeAction.preferred
Part of #62110

Use the more generic name as suggested in https://github.com/Dart-Code/Dart-Code/issues/1393. This makes the intent of the field more clear and also allows us to extend the concept of preferred code actions to refactorings and other classes of code actions

Experimentally also allows a `preferred` value for `apply` when configuring code aciton keyboard shortcuts. This applies the preferred code action returned from the list of code actions returned
2019-01-21 14:09:30 -08:00
Matt Bierner
1904cd8d84 Prototype auto fixable quick fixes
Part of #62110

- Adds a new field `canAutoApply` to code actions. This field indicates that a code action can be applied without additional user input. For quick fixes, this should be set if the fix properly addresses the error

- Enable auto fixes for TS spelling errors

- Added a `editor.action.autoFix` command to triggers auto fixes at the current cursor position
2019-01-16 17:56:22 -08:00
Matt Bierner
2ab82c12ed Make sure we opt in to new TS user preferences for enabling rename features
Fixes #66176
2019-01-11 15:42:03 -08:00
Matt Bierner
adb4b04bfd Fix type error 2019-01-11 14:40:17 -08:00
Matt Bierner
beef295f9a Normalize the TS server path in logged TS server errors 2019-01-11 14:23:29 -08:00
Matt Bierner
e730375b7a Don't make semantic requests against the TS server when the languageService has been disabled 2019-01-11 14:23:29 -08:00
Matt Bierner
6682006c8b Use more explicit state for TS server states
Try to prevent the tracked server state from getting into weird invalid states and make the state more explicit
2019-01-11 14:23:29 -08:00
Matt Bierner
2f5d88899d Make NoContentResponse an constant instead of a class 2019-01-11 11:04:58 -08:00
Matt Bierner
60f232b246 Include TypeScript version in errors logged to dev tools
Fixes #66368
2019-01-11 11:04:58 -08:00
Matt Bierner
3da39a64dd Improve logging of TypeScript server errors
Fixes #66366
Fixes #66367

Avoid printing the error twice in the trace

Make sure we show helpful error information in the VS Code dev tools when a TS server error occurrs
2019-01-11 11:04:57 -08:00
Matt Bierner
d2a8ca946f Use isCancellationRequested 2019-01-11 11:04:57 -08:00
Matt Bierner
66511a0bdb Interup geterror during rename
Rename is a user triggered operation and should interupt long run error computations
2019-01-11 11:04:57 -08:00
SteVen Batten
ccdd2997a6
update AI module (#66370)
fixes #64849
2019-01-10 17:43:25 -08:00
Matt Bierner
299997228d Don't include object key types in completeFunctionCalls
Fixes #66297
2019-01-09 11:52:02 -08:00
Matt Bierner
e44801f2b3 Fix inserting of duplicate calls when using typescript.suggest.completeFunctionCalls
Fixes #18131
2019-01-08 16:25:07 -08:00
Matt Bierner
f49c40947e Add test for completeFunctionCalls 2019-01-08 16:07:40 -08:00
Matt Bierner
6eeb11ecf2 Extract updateConfig 2019-01-08 15:53:11 -08:00
Matt Bierner
d9e2246c9b Temporarily revert using word range for TS completions due to #66187 2019-01-07 17:49:58 -08:00
Matt Bierner
9d2787e42e Accepting a member completion should result in valid code
Fixes #58597

Default to replacing the word range in js/ts. This is a change in core behavior so  we'll need to see what the feedback is like for it.
2019-01-04 18:09:48 -08:00
Matt Bierner
7a4944fb64 Add pinning test for paren accept character on bracket completion 2019-01-04 18:08:17 -08:00
Matt Bierner
6494c1c513 Adding pinning test for function treating paren as commit character 2019-01-04 18:01:01 -08:00
Matt Bierner
24cb22200e Move wait to setup block 2019-01-04 17:33:08 -08:00
Matt Bierner
6366adf510 Add pinning test for period treated as bracket trigger character 2019-01-04 17:30:26 -08:00
Matt Bierner
b166d5896f Add basic pinning test for commit character var completion 2019-01-04 16:56:42 -08:00
Matt Bierner
483adec7a5 Add simple pinning test for basic completion 2019-01-04 16:49:40 -08:00
Matt Bierner
df2d0c0fee Add pinning test for #53962 2019-01-04 16:29:19 -08:00
Matt Bierner
b4964bcf35 Replace some common index based for loops with for-of loops
Replaces many loops of the form:

```js
for (let i = 0; i < elements.length; ++i) {
    const i = elements[i];
   ...
}
```

with:

```js
for (const element of elements) {
    ...
}
```

Mix of a horrible regex based find/replace and manual touch ups
2019-01-03 19:11:18 -08:00
Matt Bierner
5cc00861fc Enable no-var-keyword tslint rule 2019-01-03 18:02:48 -08:00
Matt Bierner
3f8579f96a Avoid some common type casts
Casts can hide some type errors
2019-01-03 17:44:14 -08:00
Rob Lourens
ef2547d547 replace void 0 with undefined 2019-01-03 11:20:19 -08:00
Matt Bierner
3e7bb120c7 Use label text indexes to mark active paramter for js/ts
Fixes #65513
2019-01-02 14:53:21 -08:00
Matt Bierner
44b5a77632 Use TS's document highlight API instead of references api to get highlights
Fixes #65921
Fixes #65051
2019-01-02 11:56:39 -08:00
Matt Bierner
494e5e8509 Fix bug for completing function name parameters if function name contained special snippet syntax 2018-12-23 22:22:38 -06:00
Matt Bierner
8ac2c23fdc Don't force convert fixable diagnostics to numbers
Fixes #64848 for the VS Code side
2018-12-14 14:57:37 -08:00
Matt Bierner
45c34a2c51 Remove extra Array.from 2018-12-14 14:57:37 -08:00
Matt Bierner
7632e0133e Use clear 2018-12-14 14:57:37 -08:00
Matt Bierner
83ce38f6de Make fixPathPrefixes a bit more resiliant 2018-12-14 14:57:36 -08:00
Prabhanjan S Koushik
0f5b2d14e7 Fix #64253 - Support ~/ paths for typescript.tsdk (#64892)
* fix-64253 Added fixPathPrefixes

* fix-64253 Removed  and handled ~/path
2018-12-14 14:18:24 -08:00
Matt Bierner
a87dc2b62f Interup getError for refactor and updatePaths on rename
These are user triggered operations that should interupt the background getError requests
2018-12-14 13:48:53 -08:00
Matt Bierner
d02be78457 Show progress during update JS/TS imports
Fixes #64986
2018-12-14 13:29:57 -08:00
Matt Bierner
90f36693c9 Extend disposable 2018-12-14 12:54:07 -08:00
Matt Bierner
bb8fc43f72 Remove un-needed cast 2018-12-14 12:52:48 -08:00
Matt Bierner
6b89247875 Allow extension contributed TS plugins to be loaded for workspace versions of TS
Fixes #65031

Adds a `enableForWorkspaceTypeScriptVersions` flag (default false) to the plugins contributions that  allows a contributed plugin to be loaded for workspace versions of ts
2018-12-13 14:29:32 -08:00
Matt Bierner
5dc52f0617 Extract getCodeLensLabel 2018-12-12 18:07:37 -08:00
Matt Bierner
314b7d75a3 Use text icon for js text suggestions
Fixes #64777
2018-12-11 16:18:58 -08:00
Matt Bierner
7683decdb5 Adding more tests for cached response 2018-12-10 14:12:33 -08:00
Matt Bierner
2b7278c712 Adding better test case for not caching cancelled responses 2018-12-10 14:12:33 -08:00
Matt Bierner
68e0182064 Add test for not caching cancelled response 2018-12-10 14:12:33 -08:00
Matt Bierner
863aee78b6 Adding basic test for cached response 2018-12-10 14:12:33 -08:00
Matt Bierner
aa990b4528 Don't cache cancelled ts server responses
Fixes #64649
2018-12-10 14:12:33 -08:00
Matt Bierner
8b4924d755 Build VS Code using TS 3.2
Fixes #64631
2018-12-07 14:25:14 -08:00
Matt Bierner
a4bed89652 💄 2018-12-07 14:25:14 -08:00
Matt Bierner
98f236872e Use undefined instead of null 2018-12-07 14:25:14 -08:00
Matt Bierner
3fc69f20ab Add toOpenedFilePath method
Make sure we don't try making requests against TS for files that are not currently open
2018-12-07 14:25:14 -08:00
Matt Bierner
7140c91245 Never return undefined for cachedResponse.execute 2018-12-07 14:25:14 -08:00
Matt Bierner
98605b6a4e Extract cached response to own file 2018-12-07 14:25:14 -08:00
Matt Bierner
5562872fea Remove workaround for ts infer type suggestions showing up with no quick fix
This should not be needed now that we are shipping TS 3.2.2
2018-12-06 20:09:23 -08:00
Matt Bierner
07f6967a68 Cache document symbol navtree requests
Fixes #64570
2018-12-06 16:26:48 -08:00
Matt Bierner
ad8d18edf3 Match signature context field name to type name 2018-12-04 17:06:59 -08:00
Matt Bierner
5010af1171 Hide infer type suggestions when using broken versions of ts
Fixes #64395
2018-12-04 16:18:30 -08:00
Matt Bierner
f264e8f33b Make sure our temp ts directory really exists
Fixes possible cause of #64132

Some system operations or users may clear out this folder. This should not prevent TS from launching
2018-12-03 16:24:27 -08:00
Matt Bierner
64117e8fb5 Rename TriggerReason -> TriggerKind
Fixes #64216
2018-12-03 13:53:53 -08:00
Matt Bierner
e42d74ce9a Fix completions for intellicode
IntelliCode uses `insertText`  on all of its suggestions. When completing properties, we were incorrectly assuming that only bracket suggestions would use `insertText`
2018-12-02 11:53:15 -08:00
Matt Bierner
e39a97deb7 Fix snippet function call completions for intellicode 2018-12-02 11:53:15 -08:00
Matt Bierner
a3378e4342 Add pinning test for bracket completions 2018-11-29 17:09:48 -08:00
Matt Bierner
c5afb50a5b Added test for #63100 2018-11-29 17:09:48 -08:00
Matt Bierner
06a64b097f Extract joinLines 2018-11-29 17:09:48 -08:00
Matt Bierner
beb5998ea3 Correctly sort bracket accessor completions in js/ts completion list
Fixes #63100

As suggested in  #63100, always set the range for member completions and overwrite the dot
2018-11-29 15:09:44 -08:00
Matt Bierner
e42051996b Don't trigger parameter hints when completing empty method
Fixes #64023
2018-11-29 12:03:36 -08:00
Matt Bierner
3f33ef2593 Support whitespace after dot for bracket completions
Fixes #64002
2018-11-29 10:44:27 -08:00
Matt Bierner
cd5b4d1bb3 Use insertText as filterText for js/ts completions by default
For some completions—such as those provided
 by IntelliCode—the label results in the incorrect sort order. IntelliCode prefixes completion labels with a unicode star, which means they appear after the normal completions

This fix make sure we use the actual text to be inserted for filtering by default instead of the label
2018-11-28 19:05:40 -08:00
Matt Bierner
364824a864 use simpler typeof check 2018-11-28 19:01:22 -08:00
Peng Lyu
63710859e6
Merge pull request #63792 from vim88/fix_typo_in_comments
Fixes typo and occurrences of double words in comments.
2018-11-28 10:54:52 -08:00
Matt Bierner
9d2251469f Do not display errors in editor for cancelled js/ts code lenses
Fixes #63884

Resolving a code lenses may be cancelled if the document changes. This is normal and should not be displayed as an error in the editor
2018-11-27 17:11:07 -08:00
Matt Bierner
42145f1f0c Interupt TS references and implementations requests
Fixes #60213

These are low priority UI elements and should not block user ui requests that come in, such as completions
2018-11-27 16:48:11 -08:00
Matt Bierner
1a1987dee6 Revert "Delegate js/ts code lenses back to vs code"
This reverts commit dc47417f54.

We need finer control over how code lenses are resolved. This is required for #60213. Showing all references in the references code lense now requires using ts plugin instead
2018-11-27 16:48:11 -08:00
Matt Bierner
9461f661f0 Interupt geterror requests for signature help requests
See 7eed623657 for more details
2018-11-27 15:12:10 -08:00
Matt Bierner
7eed623657 Interupt geterror requests for getting completion entry details
UI actions like this should interup potentially long running getError requests on the server. This is because the getErr request must be fully processed before the completion entries can be returned. Explicit user actions in the UI are more important and should be computed as soon as possible
2018-11-27 14:56:07 -08:00
Matt Bierner
f685215dd4 Adding version info for ts non-code dependencies
Fixes  #63577
2018-11-27 11:40:27 -08:00
Matt Bierner
336db91acb Use switch case 2018-11-27 11:40:27 -08:00
Matt Bierner
9531a7c380 💄 2018-11-27 11:40:27 -08:00
Matt Bierner
0c126b0608 Extract display part kinds to constants files 2018-11-27 11:40:27 -08:00
Matt Bierner
bab1ea6c27 💄 2018-11-27 11:40:27 -08:00
Matt Bierner
ca7f6c2cf2 Move snippetForFunctionCall to own file 2018-11-27 11:40:27 -08:00
Matt Bierner
77454b24bc Extract append joined placeholders 2018-11-27 11:40:27 -08:00
Matt Bierner
0aef227bbf Try splitting up parameter list extraction from snippet building 2018-11-27 11:40:27 -08:00
Matt Bierner
61ad185759 Make it clearer that insert text snippets override the rest snippet generation 2018-11-27 11:40:27 -08:00
Matt Bierner
d5843e550f Fix bug for generating snippet if the object type contained a method signature 2018-11-27 11:40:27 -08:00
Matt Bierner
1755715a13 Fix bug where return type containing function type could be merged with normal parameters 2018-11-27 11:40:26 -08:00
Matt Bierner
86d7fd923a Adding pinning test for inline types 2018-11-27 11:40:26 -08:00
Matt Bierner
af05b65331 Adding plnning test for rest paramters 2018-11-27 11:40:26 -08:00
Matt Bierner
e8f00e763a Adding pinning test for getting parameters 2018-11-27 11:40:26 -08:00
Matt Bierner
ece1bad312 Adding basic pinning tests for insert text 2018-11-27 11:40:26 -08:00
Matt Bierner
ec3cba2661 Add test for using insert text 2018-11-27 11:40:26 -08:00
Matt Bierner
ecce9249cb Extract snippetForFunctionCall so that it can be tested 2018-11-27 11:40:26 -08:00
vim88
510d90d11e Fixes typo and occurrences of double words in comments. 2018-11-26 19:57:48 +02:00
isidor
1e3efda93c polish cgmanifest.json 2018-11-20 17:02:09 +01:00
isidor
085f4656ed add some commit hashes and versions to cgmanifest.json 2018-11-20 16:31:08 +01:00
Isidor Nikolic
ec98c79d44
Merge pull request #63497 from Microsoft/isidorn/cgmanifest
Start using component governance for oss tracking
2018-11-20 12:54:47 +01:00
isidor
9edd984da8 delete OSSREADME.json 2018-11-20 12:54:22 +01:00
Matt Bierner
02a59c3015 Make CachedResponse generic 2018-11-19 18:48:36 -08:00
Matt Bierner
fabc627634 Move getSymbolRange out of class 2018-11-19 18:46:09 -08:00
Matt Bierner
1f1618d280 Remove extra conditional
This should always be true
2018-11-19 18:41:26 -08:00
Matt Bierner
f953906c74 Remove un-needed any cast 2018-11-19 18:24:59 -08:00
Matt Bierner
26cd646618 Remove unnessisary conditional
The body of these specific events are always non-null
2018-11-19 16:34:15 -08:00
Matt Bierner
277b96327f Enable loading indicator for subsequent js/ts project loads
Fixes #62978
2018-11-19 16:34:15 -08:00
Matt Bierner
b115d8860c Extract loadingIndicator to class 2018-11-19 16:34:15 -08:00
Matt Bierner
300f1b8d98 Extract lazy activation logic 2018-11-19 16:34:15 -08:00
Matt Bierner
575e1630d5 Add API so that extensions can configure TS Server plugins
Fixes #63181

This is a replacement for the `_typescript.configurePlugin` command. Using a command, it is easy to forget to check if the js-ts extension is active before executing it. Using an actual api prevents this  and also allows better typing
2018-11-19 14:59:19 -08:00
Matt Bierner
0bfb7fcb54 Add metadata on completions accepted api 2018-11-19 11:04:03 -08:00
Alex Dima
976cfe3aa7 Merge branch 'master' into isidorn/cgmanifest 2018-11-16 17:52:27 +01:00
Johannes Rieken
c507f6347b set outline label for TypeScript and launch.json, #62839 2018-11-16 16:08:55 +01:00
Matt Bierner
a6b8074a19 Remove is 2018-11-15 18:10:35 -08:00
Matt Bierner
8244f81b65 Simplify data2String 2018-11-15 18:07:57 -08:00
Matt Bierner
78de541d49 Delete unused log level and type levels 2018-11-15 18:07:20 -08:00
Matt Bierner
07a5118d23 Make sure we dispose of pluginManager 2018-11-15 17:59:35 -08:00
Matt Bierner
0dd2f7487f Don't eagerly construct surveys 2018-11-15 17:56:40 -08:00
Matt Bierner
a0f0ee42e9 Move survey ready logic into Surveyor 2018-11-15 17:54:46 -08:00
Matt Bierner
106cbdec2c Extract api to own file 2018-11-15 17:50:28 -08:00
Matt Bierner
ca68cfd75d Split commands into own files 2018-11-15 17:44:56 -08:00
Matt Bierner
dc03204cc2 Improve names 2018-11-15 17:44:56 -08:00
Matt Bierner
71f86e584d Merge plugin config provider into plugin manager 2018-11-15 17:44:56 -08:00
Matt Bierner
5da4d1188e Encapsulate plugins in plugins manager 2018-11-15 17:44:56 -08:00
Matt Bierner
01511eeb28 Make plugin.languages readonly 2018-11-15 17:44:56 -08:00
Matt Bierner
49fd31af84 Move plugin config provider to plugins file 2018-11-15 17:44:56 -08:00
Matt Bierner
3c78e312c6 Remove extra tslint file 2018-11-15 17:44:56 -08:00
Matt Bierner
ac95482f6d Pick up TS 3.2 rc 2018-11-15 17:44:56 -08:00
Matt Bierner
f31bc50d1c Use correct position for requesting closing jsx tags
Fixes #63178

Make sure we compute the correct line and offset for multi-line changes
2018-11-14 18:37:00 -08:00
Matt Bierner
80aeb774f6 Fix possible undefined access exception when using apply "first" for a code action and no code actions are returned
Fixes #63101
2018-11-14 15:39:34 -08:00
Matt Bierner
813d3aa393 Fixing some more restrictive tslint errors 2018-11-14 14:45:13 -08:00