Giter Site home page Giter Site logo

fsprojects / fsharp-linting-for-vs Goto Github PK

View Code? Open in Web Editor NEW
33.0 8.0 4.0 125 KB

Visual Studio Linter for F#

Home Page: https://marketplace.visualstudio.com/items?itemName=asti.fslint-vs

C# 96.52% HTML 3.17% PowerShell 0.32%
fsharp linter analyzer vsix visual-studio

fsharp-linting-for-vs's Introduction

Linting For F#

This is a full-featured Visual Studio integration for the FSharpLint project.

Features

  • Live error tagging
  • Shows warnings in Quick Info tooltip
  • Filterable warnings in errors panel
  • Links to issues
  • Code fixes
  • Warning suppression in smart actions
  • Fast, in-process linting
  • Fully asynchronous

Configuration

We look for a fsharplint.json in this order:

  • In the same folder as the current document
  • In the project (.fsproj) directory
  • In the solution (.sln) directory
  • In the directory above the solution directory, if it exists

In action

fslint

Options

Linter options can be found in F# Tools > Linting

FsLintOptions

See an issue?

If you see an issue with the Visual Studio integration or with configuration, please file it here.

License

This project is licensed under the MIT license, a copy of which can be found here.

fsharp-linting-for-vs's People

Contributors

deviousasti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fsharp-linting-for-vs's Issues

Add docs

  • Add readme
  • Add usage docs
  • Add marketplace link

fslint

VS integration not working?

Version: 0.2
Visual Studio version: 16.6.0

We've installed FSharpLint as a dotnet tool and configured a git pre-commit hook to lint files there. I also installed the F# Lint VS extension for earlier detection and fixes. Today I had a successful build with no linting errors in VS, but the pre-commit hook rejected the commit because the linter there caught a violation.
image

Additional things I noticed while trying to diagnose and gather info for this report:

The option page for the extension is completely blank
image

The version appears a 0.2 in the extension manager but as 0.1 in Help | About Visual Studio
image

image

Config in fsharplint.json not being loaded

When I run the extension with a project open which has the configuration in the default file (fsharplint.json in the root of the repo), the configuration isn't loaded by the extension when linting. I believe this is because the extension calls into FSharpLint through Lint.ParsedFileInformation, and FSharpLint is looking for the default configuration in ./fsharplint.json, from the current working directory. So the current working directory is likely the directory of the file being linted, and not necessarily the root of the repo or project.

This is probably a bigger question than just the extension. Ideally, every integration for FSharpLint should use similar rules for loading the default config, so possibly there should be a change in FSharpLint itself to make this work more consistently. But I'm not sure what would make the most sense. One option would be to load fsharplint.json in the current directory, or in any of the parent directories of the current directory.

Update FSharpLint

FSharpLint has a couple of commits since the submodule commit hash d81a422.
Especially the configuration file has been changed and the file linked in the official FSharpLint docs is out of sync from the default contained in d81a422.

The submodule should be updated to the latest release.

An exception of type MissingMethodException has been encountered

I just installed F# Lint 0.4.1 on VS 2019 16.8.0

System.MissingMethodException: Method not found: 'ParserResult`2<!!0,Microsoft.FSharp.Core.Unit> FParsec.CharParsers.run(Microsoft.FSharp.Core.FSharpFunc`2<FParsec.CharStream`1<Microsoft.FSharp.Core.Unit>,FParsec.Reply`1<!!0>>, System.String)'.
   at FSharpLint.Framework.Configuration.parseHint@548(String hint)
   at FSharpLint.Framework.Configuration.parseHints(String[] hints)
   at FSharpLint.Framework.Configuration.deprecatedAllRules@566-3.Invoke(HintConfig config)
   at Microsoft.FSharp.Core.OptionModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpOption`1 option) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\option.fs:line 53
   at FSharpLint.Framework.Configuration.flattenConfig(Configuration config)
   at FSharpLint.Application.Lint.lint(LintInfo lintInfo, FileParseInfo fileInfo)
   at FSharpLint.Application.Lint.lintParsedSource(OptionalLintParameters optionalParams, ParsedFileInformation parsedFileInfo)
   at FSharpLintVs.LintChecker.<DoUpdateAsync>d__48.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.ThreadingTools.<WithCancellationSlow>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at FSharpLintVs.LintActionsSource.<>c__DisplayClass11_0.<<HasSuggestedActionsAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.<CallExtensionPointAsync>d__36`1.MoveNext() --- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.