Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Getting Started Docs: Calling Analyzers w/ FAKE #225

Merged
merged 5 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/Dual Analyzer.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(**
---
category: end-users
categoryindex: 1
index: 3
categoryindex: 2
index: 2
---

# Writing an analyzer for both console and editor
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Getting Started Writing.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(**
---
category: end-users
categoryindex: 1
index: 2
categoryindex: 2
index: 1
---

# Getting started writing an analyzer
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Programmatic access.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(**
---
category: end-users
categoryindex: 1
index: 4
categoryindex: 2
index: 3
---

# Programmatically running an analyzer
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Running during CI.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
category: end-users
categoryindex: 1
index: 6
categoryindex: 2
index: 5
---

# Running analyzers during continuous integration
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Unit Testing.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(**
---
category: end-users
categoryindex: 1
index: 5
categoryindex: 2
index: 4
---

# Unit testing an analyzer
Expand Down
33 changes: 33 additions & 0 deletions docs/content/getting-started/CLI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
category: getting-started
categoryindex: 1
index: 3
---

# Command Line Arguments

## Example Command

When running the CLI tool from the command line, the bare minimum you need to provide is the path to the project file(s) you want to analyze.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a bit misleading. It sounds like something will happen simply by downloading the tool and pointing it to a project, but you actually need to provide an analyzer.

The default argument will only have an effect if you:

  • Use Paket in the old mode with that exact default folder name.
  • Already have a compatible analyzer.

This scenario seems quite unlikely at this point. It might be better to mention later that if you omit the --analyzers-path, it defaults to packages/analyzers.


```shell
dotnet fsharp-analyzers --project ./YourProject.fsproj
```

An optional argument you may need to provide is `--analyzers-path`. This is the path to the directory containing the analyzer DLLs.

```shell
dotnet fsharp-analyzers --project ./YourProject.fsproj --analyzers-path ./path/to/analyzers/directory
```

⚠️ If you don't provide this argument, it will default to `packages/analyzers`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really a Paket thing and should be mentioned as such. Folks using NuGet might not get how you can ever download the analyzers in that folder.


## Viewing Additional Commands

You can view the full list of commands available by running:

```shell
dotnet fsharp-analyzers --help
```

[Next]({{fsdocs-next-page-link}})
26 changes: 26 additions & 0 deletions docs/content/getting-started/Configuring for IDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
category: getting-started
categoryindex: 1
index: 2
---

# Configuring for the IDE

## Visual Studio Code

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 only need the following settings:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheAngryByrd, where can people find the log if there's an SDK mismatch? Users may use older analyzers, which might not be detected by the tooling. I believe we mention this somewhere. I suggest including an explanation on this page about where this information will be displayed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Briefly looking at the code, I'm not sure we actually log this correctly.

Added issue here: ionide/FsAutoComplete#1350

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, thanks, @1eyewonder maybe we just link to that issue in the docs.


```json
{
"FSharp.enableAnalyzers": true,
"FSharp.analyzersPath": ["packages/analyzers"]
}
```

📓 Note: The path in `FSharp.analyzersPath` above is currently pointing to the path we set up in the Paket example on the [installation page]({{fsdocs-previous-page-link}}).

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

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

[Next]({{fsdocs-next-page-link}})
50 changes: 50 additions & 0 deletions docs/content/getting-started/Installing Analyzers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
category: getting-started
categoryindex: 1
index: 1
---
# Installation

## Installing the Tool

A dotnet CLI tool, called [fsharp-analyzers](https://github.com/ionide/FSharp.Analyzers.SDK/), is used to run analyzers outside the context of an IDE. Add it to your tool-manifest with:

```shell
dotnet tool install fsharp-analyzers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dotnet tool install fsharp-analyzers
dotnet tool install fsharp-analyzers --create-manifest-if-needed

```

## Installing Analyzers

### Suggested Packages

1. [Ionide Analyzers](https://github.com/ionide/FSharp.Analyzers.SDK/)
2. [G-Research Analyzers](https://github.com/G-Research/fsharp-analyzers/)

### Nuget

If you are using Nuget as your package manager, add the `PackageReference` pointing to your favorite analyzers to the `.fsproj` file of the project you want to analyze.

```xml
<PackageReference Include="G-Research.FSharp.Analyzers" Version="0.12.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Ionide.Analyzers" Version="0.28.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers</IncludeAssets>
</PackageReference>
```

### Paket

If you are using Paket as your package manager, add the package to your `paket.dependencies` file. The example below uses a paket group, but it is not required.

```paket
group analyzers
source https://api.nuget.org/v3/index.json

nuget Ionide.Analyzers
nuget G-Research.FSharp.Analyzers
```

[Next]({{fsdocs-next-page-link}})
Loading
Loading