Skip to content

Commit 9271790

Browse files
authored
Merge pull request #255 from ionide/nuget-analyzers-docs
Enhance IDE configuration documentation for analyzers
2 parents 7362d9c + c778b81 commit 9271790

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

docs/content/getting-started/Configuring for IDE.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,46 @@ index: 2
66

77
# Configuring for the IDE
88

9+
Currently, analyzers are only supported in FsAutocomplete/Ionide, which is used by Visual Studio Code and other editors that support the Language Server Protocol (LSP).
10+
911
## Visual Studio Code
1012

11-
In order to configure analyzers for VSCode, you will need to update your project's `.vscode/settings.json` file or your user settings. You should need the settings shown below.
13+
In order to configure analyzers for VSCode, there are 2 ways.
14+
15+
### Using NuGet Packages
16+
17+
For each project where you want to enable analyzers, add the following to your `.fsproj` file:
18+
19+
```xml
20+
<ItemGroup>
21+
<PackageReference Include="Ionide.Analyzers" Version="0.14.7" PrivateAssets="All" />
22+
</ItemGroup>
23+
```
24+
25+
or if using [Central Package Management](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management) in your `Directory.Packages.props`:
26+
27+
```xml
28+
<ItemGroup>
29+
<PackageVersion Include="Ionide.Analyzers" Version="0.14.7" />
30+
</ItemGroup>
31+
```
32+
and then reference it in your project files as:
33+
34+
```xml
35+
<ItemGroup>
36+
<PackageReference Include="Ionide.Analyzers" PrivateAssets="All" />
37+
</ItemGroup>
38+
```
39+
40+
**NOTE**: The `PrivateAssets="All"` is important to ensure that the analyzer package does not get included in your published application. See [Controlling dependency assets](https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets) for more information.
41+
42+
After adding the package reference, you may need to do a `dotnet restore` to force FsAutocomplete to pick up the new analyzers for a specific project.
43+
44+
### Configure a predefined path
45+
46+
This is useful if you're using `paket` to install analyzers to a specific directory in your project or have custom built analyzers to test against.
47+
48+
You will need to update your project's `.vscode/settings.json` file or your user settings. You should need the settings shown below.
1249

1350
```json
1451
{
@@ -17,10 +54,26 @@ In order to configure analyzers for VSCode, you will need to update your project
1754
}
1855
```
1956

20-
📓 Note: Issue created [here](https://github.com/ionide/FsAutoComplete/issues/1350) regarding analyzers & SDK mismatches in the logs
57+
After saving your new settings, FsAutocomplete should try to reload analyzers.
58+
59+
---
60+
2161

22-
After saving your new settings, make sure to restart VSCode. Once VSCode restarts, you should be able to test and see if the analyzers are working by opening a F# file in your workspace and entering the following code
62+
63+
You should be able to test and see if the analyzers are working by opening a F# file in your workspace and entering the following code.
2364

2465
![Analyzers Inline Warning](../../images/analyzers-inline-warning.png)
2566

26-
[Next]({{fsdocs-next-page-link}})
67+
[Next]({{fsdocs-next-page-link}})
68+
69+
If not, you can enable `FSharp.verboseLogging`, restart VSCode, then open the Output pane (1) with the `F#` output channel selected (2).
70+
71+
```json
72+
{
73+
"FSharp.verboseLogging": true
74+
}
75+
```
76+
77+
You can then search (Cmd/Ctrl+F while in the Output pane) for `FsAutoComplete.Analyzer` (3) prefix in the log to see if analyzers are being loaded correctly.
78+
79+
![FsAutoComplete Analyzer Logging](../../images/FsAutocomplete-Analyzer-Logs.png)
347 KB
Loading

0 commit comments

Comments
 (0)