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

Anaylizer does not work in vscode #38

Closed chengh42 closed 2 years ago

chengh42 commented 2 years ago

Describe the bug

Hi, we would love to use the Analyzer along with Npgsql.FSharp for query syntax check, however cannot have it work following the instructions. We are using vscode with the Ionide-fsharp extension.

Attaching the code: NpgsqlFSharp.zip ... where we've checked the following:

Expected behavior

Edit the query with invalid table name etc., expected to get error highlighting; but there were no query syntax check (see screenshot below).

Screenshot 2022-01-10 170201

Versions

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   6.0.100     
 Commit:    9e8b04bbff  

Runtime Environment:    
 OS Name:     Windows   
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  3.1.405 [C:\Program Files\dotnet\sdk]
  5.0.100-rc.2.20479.15 [C:\Program Files\dotnet\sdk]
  5.0.201 [C:\Program Files\dotnet\sdk]
  6.0.100 [C:\Program Files\dotnet\sdk]
chengh42 commented 2 years ago

... just found in the Output terminal the error messages, which seem to be the same case as reported in https://github.com/Zaid-Ajaj/Npgsql.FSharp.Analyzer/issues/37 :

[Error - 5:29:54 PM] Request textDocument/documentHighlight failed.
  Message: No symbol information found
  Code: -32603 
[17:29:54.616 ERR] [Analyzers] Analyzer Npgsql.FSharp.Analyzer errored while processing c:\mydojo\codingDojo\NpgsqlFSharp\Program.fs: 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

... sorry, did not check thoroughly beforehand!

chengh42 commented 2 years ago

Duplicate of #37