Autofill for JSDocs (#20625)

* Add autofill for JSDocs

Adds prototype of autofill for jsdoc comments. For code like:

```js
    /**|
    function mul(x, y) {
        return x * y;
    }
```

When you press return, we will complete it to:

```js
    /**
     *
     * @param x
     * @param y
     */
    function mul(x, y) {
        return x * y;
    }
```

In Typescript and to:

```js
    /**
     *
     * @param {any} x
     * @param {any} y
     */
    function mul(x, y) {
        return x + y;
    }
```

In JavaScript

* Handle revert case better

* Disable on enter when suggestion is visible
This commit is contained in:
Matt Bierner
2017-02-15 14:04:36 -08:00
committed by GitHub
parent e0354d386a
commit fe742d3800
4 changed files with 131 additions and 1 deletions

View File

@@ -36,6 +36,7 @@
"onCommand:typescript.selectTypeScriptVersion",
"onCommand:javascript.goToProjectConfig",
"onCommand:typescript.goToProjectConfig",
"onCommand:_typescript.tryCompleteJsDoc",
"workspaceContains:jsconfig.json",
"workspaceContains:tsconfig.json"
],
@@ -83,6 +84,18 @@
}
}
],
"keybindings": [
{
"key": "enter",
"command": "_typescript.tryCompleteJsDoc",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == 'typescript'"
},
{
"key": "enter",
"command": "_typescript.tryCompleteJsDoc",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == 'javascript'"
}
],
"configuration": {
"type": "object",
"title": "%configuration.typescript%",
@@ -279,7 +292,7 @@
"title": "%typescript.goToProjectConfig.title%",
"category": "TypeScript"
},
{
{
"command": "javascript.goToProjectConfig",
"title": "%javascript.goToProjectConfig.title%",
"category": "JavaScript"