Zaid-Ajaj / Npgsql.FSharp.Analyzer

F# analyzer that provides embedded SQL syntax analysis, type-checking for parameters and result sets and nullable column detection when writing queries using Npgsql.FSharp.
MIT License
137 stars 9 forks source link

Can't get the analyzer to work with Ionide #37

Open rodrigoj42 opened 2 years ago

rodrigoj42 commented 2 years ago

Describe the bug After installing Npgsql.FSharp.Analyzer and adding the necessary settings to Ionide I get this error in Ionide's output:

[16:54:48.502 ERR] [Analyzers] Analyzer Npgsql.FSharp.Analyzer errored while processing <file>: Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.MissingMethodException: Method not found: 'ParsedInput FSharp.Analyzers.SDK.Context.get_ParseTree()'.
   at Npgsql.FSharp.Analyzers.SqlAnalyzer.sqlAnalyzerContext(Context ctx)
   at Npgsql.FSharp.Analyzers.SqlAnalyzer.queryAnalyzer(Context ctx) in C:\projects\NpgsqlFSharpAnalyzer\src\NpgsqlFSharpAnalyzer\SqlAnalyzer.fs:line 40
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at FSharp.Analyzers.SDK.Client.getAnalyzerFromMemberInfo@39-1.Invoke(Context ctx) in /Users/chethusk/oss/FSharp.Analyzers.SDK/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.Client.fs:line 39
   at FSharp.Analyzers.SDK.Client.runAnalyzersSafely@117.Invoke(Tuple`2 tupledArg) in /Users/chethusk/oss/FSharp.Analyzers.SDK/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.Client.fs:line 120
[Error - 4:54:48 PM] Request textDocument/documentHighlight failed.
  Message: No symbol information found
  Code: -32603 
[Error - 4:54:48 PM] Request textDocument/documentHighlight failed.
  Message: No symbol information found
  Code: -32603 

I'm not entirely sure what to make of this, as I haven't worked with analyzers before — I don't even know if it's a problem with this package or with FSharp.Analyzers.SDK, to be honest. I've tried uninstalling Npgsql.FSharp.Analyzer and then installing it back again using both nuget and paket (I thought maybe there was a versioning issue) but it didn't make a difference. I've also tried to reinstall Ionide.

Desktop:

Additional context This error does not happen when using Ubik (version 3.28.0)

Any assistance will be greatly appreciated.

bonjune commented 1 year ago

https://github.com/Zaid-Ajaj/Npgsql.FSharp.Analyzer/blob/798ab4fe989690688d61ed1196ca79bb4e1aca37/src/NpgsqlFSharpAnalyzer/SqlAnalyzer.fs#L30-L35

The error message indicates that ctx.ParseTree property is not found. Seems like is its the interface of Context object has been changed.