Skip to content

Commit c3a13cf

Browse files
author
Orta
authored
Merge pull request #220 from rbiggs/master
Fixed broken link for JSDoc support.
2 parents ffff5b7 + 41861b2 commit c3a13cf

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

JavaScript-Language-Service-in-Visual-Studio.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Visual Studio 2017 provides a powerful JavaScript editing experience right out o
44

55
> The JavaScript language service in Visual Studio 2017 uses a new engine for the language service (former code name "Salsa"). Details are included here in this topic, and you might also want to read this [blog post](https://blogs.msdn.microsoft.com/visualstudio/2016/11/28/more-productive-javascript-in-visual-studio-2017-rc/). The new editing experience also mostly applies in VS Code. See the [VS Code docs](https://code.visualstudio.com/docs/languages/javascript) for more info.
66
7-
For more information about the general IntelliSense functionality of Visual Studio, see [Using IntelliSense](https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense).
7+
For more information about the general IntelliSense functionality of Visual Studio, see [Using IntelliSense](https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense).
88

9-
## What's New in the JavaScript language service in Visual Studio 2017
9+
## What's New in the JavaScript language service in Visual Studio 2017
1010
- [Richer IntelliSense](#Rich)
1111
- [Automatic acquisition of type definitions](#Auto)
1212
- [Support for ES6 and beyond](#ES6)
@@ -21,11 +21,11 @@ TypeScript uses several sources to build up this information.
2121
- [IntelliSense based on TypeScript Declaration Files](#TSDeclFiles)
2222

2323
#### <a name="TypeInference"></a>IntelliSense based on type inference
24-
In JavaScript, most of the time there is no explicit type information available.
24+
In JavaScript, most of the time there is no explicit type information available.
2525
Luckily, it is usually fairly easy to deduce a type given the surrounding code context.
2626
This process is called type inference.
2727

28-
For a variable or property, the type is typically the type of the value used to initialize it or the most recent value assignment.
28+
For a variable or property, the type is typically the type of the value used to initialize it or the most recent value assignment.
2929

3030
```js
3131
var nextItem = 10;
@@ -35,7 +35,7 @@ nextItem = "box";
3535
nextItem; // now we know nextItem is a string
3636
```
3737

38-
For a function, the return type can be inferred from the return statements.
38+
For a function, the return type can be inferred from the return statements.
3939

4040
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).
4141

@@ -70,7 +70,7 @@ x.b = false;
7070
x. // <- "x" is shown as having properties a, b, and c of the types specified
7171
```
7272

73-
As mentioned, function parameters are never inferred. However, using the JSDoc `@param` tag you can add types to function parameters as well.
73+
As mentioned, function parameters are never inferred. However, using the JSDoc `@param` tag you can add types to function parameters as well.
7474

7575
```js
7676
/**
@@ -80,8 +80,8 @@ function Foo(param1) {
8080
this.prop = param1; // "param1" (and thus "this.prop") are now of type "string".
8181
}
8282
```
83-
84-
See [this doc](https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript) for the JsDoc annotations currently supported.
83+
84+
See [this doc](https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md) for the JsDoc annotations currently supported.
8585

8686
#### <a name="TsDeclFiles"></a> IntelliSense based on TypeScript Declaration Files
8787

@@ -96,11 +96,11 @@ _**TypeScript declarations used in JavaScript**_
9696
## <a name="Auto"></a> Automatic acquisition of type definitions
9797
In the TypeScript world, most popular JavaScript libraries have their APIs described by `.d.ts` files, and the most common repository for such definitions is on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
9898

99-
By default, the Salsa language service will try to detect which JavaScript libraries are in use and 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`.
99+
By default, the Salsa language service will try to detect which JavaScript libraries are in use and 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`.
100100

101101
> This feature is **disabled** by default if using a `tsconfig.json` configuration file, but may be set to enabled as outlined further below).
102102
103-
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.
103+
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.
104104

105105
If you do not wish to use auto-acquisition, disable it by adding a configuration file as outlined below. You can still place definition files for use directly within your project manually.
106106

@@ -118,7 +118,7 @@ The required settings for the tsconfig file are outlined below:
118118
By default this is `false`, as TypeScript compiles to JavaScript, and this is necessary to avoid the compiler including files it just compiled.
119119
- `outDir`: This should be set to a location not included in the project, in order that the emitted JavaScript files are not detected and then included in the project (see `exclude` below).
120120
- `module`: If using modules, this setting tells the compiler which module format the emitted code should use (e.g. `commonjs` for Node or bundlers such as Browserify).
121-
- `exclude`: This setting states which folders not to include in the project.
121+
- `exclude`: This setting states which folders not to include in the project.
122122
The output location, as well as non-project folders such as `node_modules` or `temp`, should be added to this setting.
123123
- `enableAutoDiscovery`: This setting enables the automatic detection and download of definition files as outlined above.
124124
- `compileOnSave`: This setting tells the compiler if it should recompile any time a source file is saved in Visual Studio.
@@ -181,7 +181,7 @@ exports.default = Subscription_1.Subscription;
181181

182182
## <a name="JSX"></a> JSX syntax support
183183

184-
JavaScript in Visual Studio 2017 has rich support for the JSX syntax. JSX is a syntax set that allows HTML tags within JavaScript files.
184+
JavaScript in Visual Studio 2017 has rich support for the JSX syntax. JSX is a syntax set that allows HTML tags within JavaScript files.
185185

186186
The illustration below shows a React component defined in the `comps.tsx` TypeScript file, and then this component being used from the `app.jsx` file, complete with IntelliSense for completions and documentation within the JSX expressions.
187187
You don't need TypeScript here, this specific example just happens to contain some TypeScript code as well.
@@ -198,7 +198,7 @@ var comps_1 = require('./comps');
198198
var x = React.createElement(comps_1.RepoDisplay, {description: "test"});
199199
```
200200

201-
## Notable Changes from VS 2015
201+
## Notable Changes from VS 2015
202202
As Salsa is a completely new language service, there are a few behaviors that will be different or absent from the previous experience.
203203
The most notable of these changes are the replacement of VSDoc with JSDoc, the removal of custom `.intellisense.js` extensions, and limited IntelliSense for specific code patterns.
204204

@@ -219,7 +219,7 @@ You can learn more about declaration (`.d.ts`) file authoring [here](http://www.
219219

220220
### Unsupported patterns
221221
Because the new language service is powered by static analysis rather than an execution engine (read [this issue](https://github.com/Microsoft/TypeScript/issues/4789) for information of the differences), there are a few JavaScript patterns that no longer can be detected.
222-
The most common pattern is the "expando" pattern.
222+
The most common pattern is the "expando" pattern.
223223
Currently the language service cannot provide IntelliSense on objects that have properties tacked on after declaration.
224224
For example:
225225

@@ -248,4 +248,4 @@ var obj = {};
248248
obj.a = 10;
249249
obj.b = "hello world";
250250
obj. // IntelliSense shows properties a and b
251-
```
251+
```

0 commit comments

Comments
 (0)