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

WIP - [RFC FST-1033] analyzers draft #11057

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d3efce4
analyzers draft
Feb 8, 2021
03d01a6
analyzers draft
Feb 8, 2021
0f2d736
analyzers draft
Feb 8, 2021
3b1c7f4
fix some basics
Feb 9, 2021
e025cd7
update surface area
Feb 9, 2021
92ca504
update surface area
Feb 9, 2021
89675e7
updates to contain more in result types
Feb 13, 2021
4ddc61e
allow analyzers to run in fsi.exe with --runanalyzers, also respect -…
Feb 16, 2021
c4b50cc
update baseline
Feb 16, 2021
46ab877
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Feb 16, 2021
d134f4c
fix issues with .NET core scripting references in editing
Feb 17, 2021
ea42d54
fix issues with .NET core scripting references in editing
Feb 17, 2021
0634df8
fix issues with .NET core scripting references in editing
Feb 17, 2021
3da2ab5
fix issues with .NET core scripting references in editing
Feb 17, 2021
84fe602
add tests
Feb 17, 2021
89b6a4f
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Feb 17, 2021
4fbf151
Merge branch 'fix-11115' into feature/analyzers
Feb 17, 2021
f3fd8ef
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Feb 17, 2021
77817f0
add test project
Feb 17, 2021
6d899df
interpret compilerToolPath as a path, not a file
Feb 18, 2021
647f820
interpret compilerToolPath as a path, not a file
Feb 18, 2021
534226e
better incrementality for analyzers
Feb 25, 2021
af2679c
test script for analyzer
Feb 25, 2021
8718983
merge main
Feb 25, 2021
a964a1e
merge main
Mar 1, 2021
c2e9b9f
merge main
Mar 1, 2021
8e49b2e
merge main
Mar 1, 2021
0c2751c
merge main
Mar 1, 2021
d63f87e
fix regression 11176
Mar 3, 2021
bfad0d2
integrate main
Mar 3, 2021
0bb5548
integrate fix-11176
Mar 3, 2021
dd72dcd
merge main
Mar 3, 2021
c5fdb0c
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Mar 4, 2021
b364d95
fix build
Mar 4, 2021
1c90ead
fix build
Mar 4, 2021
6bf0f5e
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Mar 11, 2021
39dc1dd
integrate main
Mar 26, 2021
57fd135
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Mar 26, 2021
2b3592c
Don't deploy Full extension after build
Mar 26, 2021
d013209
Merge branch 't6' into feature/analyzers
Mar 26, 2021
d5a5915
merge main
Apr 14, 2021
87a9caf
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Apr 16, 2021
ed79d68
merge main
May 24, 2021
d924143
update baselines
May 24, 2021
3ecf924
fix baselines
May 26, 2021
87c241c
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
May 26, 2021
0abfaee
update baselines
May 27, 2021
97c1bfc
fix build
Jun 3, 2021
66286b8
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Jun 4, 2021
163017d
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Jun 7, 2021
d898cf0
merge main and cleanup
Jun 8, 2021
b56f7b7
merge main
dsyme Jun 9, 2021
e7daabd
merge main
Jun 24, 2021
6ec7ba2
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Jun 24, 2021
7693168
simplify code
Jun 24, 2021
355dbd7
fix build
Jun 24, 2021
6f29d6e
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Jun 25, 2021
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
15 changes: 15 additions & 0 deletions VisualFSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service", "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service.Tests", "tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj", "{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TestAnalyzer", "tests\service\data\TestAnalyzer\TestAnalyzer.fsproj", "{A341304E-7223-4931-88B5-690EE88C2241}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -924,6 +926,18 @@ Global
{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}.Release|Any CPU.Build.0 = Release|Any CPU
{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}.Release|x86.ActiveCfg = Release|Any CPU
{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}.Release|x86.Build.0 = Release|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Debug|x86.ActiveCfg = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Debug|x86.Build.0 = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Proto|Any CPU.Build.0 = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Proto|x86.ActiveCfg = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Proto|x86.Build.0 = Debug|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Release|Any CPU.Build.0 = Release|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Release|x86.ActiveCfg = Release|Any CPU
{A341304E-7223-4931-88B5-690EE88C2241}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -998,6 +1012,7 @@ Global
{0610FB97-7C15-422A-86FD-32335C6DF14D} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{B5A9BBD9-2F45-4722-A6CA-BAE3C64CD4E2} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{A341304E-7223-4931-88B5-690EE88C2241} = {35636A82-401A-4C3A-B2AB-EB7DC5E9C268}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48EDBBBE-C8EE-4E3C-8B19-97184A487B37}
Expand Down
23 changes: 23 additions & 0 deletions tests/service/data/TestAnalyzer/Analyzer.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace TestAnalyzer

open FSharp.Core.CompilerServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Diagnostics
open FSharp.Compiler.Text

[<assembly: AnalyzerAssemblyAttribute>]
do()

[<AnalyzerAttribute>]
type MyAnalyzer(ctxt) =
inherit FSharpAnalyzer(ctxt)

override _.OnCheckFile(fileCtxt, ct) =

let m = Range.mkRange fileCtxt.ParseFileResults.FileName (Position.mkPos 3 0) (Position.mkPos 3 80)
let m2 = Range.mkRange fileCtxt.ParseFileResults.FileName (Position.mkPos 6 0) (Position.mkPos 6 80)
let source = fileCtxt.TryGetFileSource(fileCtxt.ParseFileResults.FileName).Value
[| if source.ToString().Contains("WIBBLE") |> not then
FSharpDiagnostic.Create(FSharpDiagnosticSeverity.Warning, "this diagnostic is always on line 6 until the magic word WIBBLE appears", 45, m2, "FA")
if source.ToString().Contains("WAZZAM") |> not then
FSharpDiagnostic.Create(FSharpDiagnosticSeverity.Warning, "this diagnostic is always on line 3 until the magic word WAZZAM appears", 45, m, "FA") |]
20 changes: 20 additions & 0 deletions tests/service/data/TestAnalyzer/TestAnalyzer.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
Copy link
Contributor

Choose a reason for hiding this comment

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

a key part of the roslyn analyzer business is they are netstandard only. it's worth requiring here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure yup makes sense

<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UnitTestType>nunit</UnitTestType>
<OtherFlags>$(OtherFlags) --nowarn:3390 --nowarn:3218</OtherFlags>
</PropertyGroup>

<ItemGroup>
<Compile Include="Analyzer.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj" />
</ItemGroup>

</Project>