Skip to content

Commit 728a025

Browse files
Merge pull request #13908 from Mikejo5000/mikejo-br25
Refactoring JS/TS editor content
2 parents f2d31e3 + 5dd0103 commit 728a025

13 files changed

+76
-512
lines changed

.openpublishing.redirection.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8108,6 +8108,46 @@
81088108
"redirect_url": "/visualstudio/get-started/csharp/tutorial-windows-forms-math-quiz-customize-ui",
81098109
"redirect_document_id": false
81108110
},
8111+
{
8112+
"source_path": "docs/ide/reference/code-analysis-project-designer.md",
8113+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/code-analysis-project-designer",
8114+
"redirect_document_id": false
8115+
},
8116+
{
8117+
"source_path": "docs/ide/reference/property-pages-javascript.md",
8118+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/property-pages-javascript",
8119+
"redirect_document_id": false
8120+
},
8121+
{
8122+
"source_path": "docs/ide/reference/file-properties-javascript.md",
8123+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/file-properties-javascript",
8124+
"redirect_document_id": false
8125+
},
8126+
{
8127+
"source_path": "docs/ide/reference/options-text-editor-javascript-formatting.md",
8128+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/options-text-editor-javascript-formatting",
8129+
"redirect_document_id": false
8130+
},
8131+
{
8132+
"source_path": "docs/ide/reference/options-text-editor-javascript-code-validation.md",
8133+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/options-text-editor-javascript-code-validation",
8134+
"redirect_document_id": false
8135+
},
8136+
{
8137+
"source_path": "docs/ide/reference/options-text-editor-javascript-intellisense.md",
8138+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/options-text-editor-javascript-intellisense",
8139+
"redirect_document_id": false
8140+
},
8141+
{
8142+
"source_path": "docs/ide/reference/options-text-editor-javascript-project.md",
8143+
"redirect_url": "/previous-versions/visualstudio/visual-studio-2017/ide/reference/options-text-editor-javascript-project",
8144+
"redirect_document_id": false
8145+
},
8146+
{
8147+
"source_path": "docs/ide/reference/options-text-editor-javascript-linting.md",
8148+
"redirect_url": "/visualstudio/javascript/linting-javascript",
8149+
"redirect_document_id": false
8150+
},
81118151
{
81128152
"source_path": "docs/ide/quickstart-nodejs.md",
81138153
"redirect_url": "/visualstudio/javascript/tutorial-nodejs",

docs/ide/javascript-intellisense.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ description: Learn how Visual Studio delivers richer IntelliSense, support for m
44
ms.date: 02/21/2023
55
ms.topic: conceptual
66
ms.subservice: javascript-typescript
7+
f1_keywords:
8+
- "VS.ToolsOptionsPages.Text_Editor.JavaScript.Intellisense.References"
9+
- "VS.ToolsOptionsPages.Text_Editor.JavaScript.Intellisense.General"
10+
- "VS.ToolsOptionsPages.Text_Editor.TypeScript.IntelliSense.General"
711
helpviewer_keywords:
812
- IntelliSense [JavaScript]
913
- <reference> JavaScript XML tag
@@ -42,7 +46,7 @@ TypeScript uses several sources to build up this information:
4246

4347
## IntelliSense based on type inference
4448

45-
In JavaScript, most of the time there is no explicit type information available. Luckily, it's usually fairly easy to figure out a type given the surrounding code context.
49+
In JavaScript, most of the time there's no explicit type information available. Luckily, it's usually easy to figure out a type given the surrounding code context.
4650
This process is called type inference.
4751

4852
For a variable or property, the type is typically the type of the value used to initialize it or the most recent value assignment.
@@ -57,9 +61,9 @@ nextItem; // now we know nextItem is a string
5761

5862
For a function, the return type can be inferred from the return statements.
5963

60-
For function parameters, there is currently no inference, but there are ways to work around this using JSDoc or TypeScript *.d.ts* files (see later sections).
64+
For function parameters, there's currently no inference, but there are ways to work around this using JSDoc or TypeScript *.d.ts* files (see later sections).
6165

62-
Additionally, there is special inference for the following:
66+
Additionally, there's special inference for the following:
6367

6468
- "ES3-style" classes, specified using a constructor function and assignments to the prototype property.
6569
- CommonJS-style module patterns, specified as property assignments on the `exports` object, or assignments to the `module.exports` property.
@@ -78,7 +82,7 @@ exports.Foo = Foo;
7882

7983
## IntelliSense based on JSDoc
8084

81-
Where type inference doesn't provide the desired type information (or to support documentation), type information may be provided explicitly via JSDoc annotations. For example, to give a partially declared object a specific type, you can use the `@type` tag as shown below:
85+
Where type inference doesn't provide the desired type information (or to support documentation), type information may be provided explicitly via JSDoc annotations. For example, to give a partially declared object a specific type, you can use the `@type` tag as shown here:
8286

8387
```js
8488
/**
@@ -104,7 +108,7 @@ See the JSDoc information in [Type Checking JavaScript Files](https://www.typesc
104108

105109
## IntelliSense based on TypeScript declaration files
106110

107-
Because JavaScript and TypeScript are based on the same language service, they are able to interact in a rich way. For example, JavaScript IntelliSense can be provided for values declared in a *.d.ts* file (see [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)), and types such as interfaces and classes declared in TypeScript are available for use as types in JSDoc comments.
111+
Because JavaScript and TypeScript are based on the same language service, they're able to interact in a rich way. For example, JavaScript IntelliSense can be provided for values declared in a *.d.ts* file (see [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)), and types such as interfaces and classes declared in TypeScript are available for use as types in JSDoc comments.
108112

109113
Below, we show a simple example of a TypeScript definition file providing such type information (via an interface) to a JavaScript file in the same project (using a `JSDoc` tag).
110114

@@ -117,10 +121,16 @@ In the TypeScript world, most popular JavaScript libraries have their APIs descr
117121
By default, the language service tries to detect which JavaScript libraries are in use, and then automatically download and reference the corresponding *.d.ts* file that describes the library in order to provide richer IntelliSense. The files are downloaded to a cache located under the user folder at *%LOCALAPPDATA%\Microsoft\TypeScript*.
118122

119123
> [!NOTE]
120-
> This feature is **disabled** by default if you're using a *tsconfig.json* configuration file, but may be set to enabled as outlined further below.
124+
> This feature is **disabled** by default if you're using a *tsconfig.json* configuration file, but may be set to enabled as outlined further in this section.
121125
122126
Currently, auto-detection works for dependencies downloaded from npm (by reading the *package.json* file), Bower (by reading the *bower.json* file), and for loose files in your project that match a list of roughly the top 400 most popular JavaScript libraries. For example, if you have *jquery-1.10.min.js* in your project, the file *jquery.d.ts* will be fetched and loaded in order to provide a better editing experience. This *.d.ts* file will have no impact on your project.
123127

128+
## Configure IntelliSense
129+
130+
You can use change the behavior of IntelliSense statement completion by selecting **Tools > Options > Text Editor > JavaScript/TypeScript > IntelliSense > General**.
131+
132+
When you select **Only use Tab or Enter to commit**, the JavaScript code editor appends statements with items selected in the completion list only after you choose the **Tab** or **Enter** key. When you deselect this check box, other characters – such as a period, comma, colon, open parenthesis, and open brace ({) – can also append statements with the selected items.
133+
124134
## Related content
125135

126136
- [Using IntelliSense](../ide/using-intellisense.md)

docs/ide/reference/code-analysis-project-designer.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

docs/ide/reference/file-properties-javascript.md

Lines changed: 0 additions & 92 deletions
This file was deleted.

docs/ide/reference/options-text-editor-javascript-code-validation.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)