Commit Graph

589 Commits

Author SHA1 Message Date
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