Skip to content

Commit

Permalink
Merge pull request #4 from Zaid-Ajaj/initial-vs-support
Browse files Browse the repository at this point in the history
Initial VS support
  • Loading branch information
Zaid-Ajaj authored Aug 17, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 17acea0 + efd7856 commit dbe65f0
Showing 71 changed files with 2,134 additions and 2,570 deletions.
30 changes: 30 additions & 0 deletions NpgsqlFSharpAnalyzer.sln
Original file line number Diff line number Diff line change
@@ -29,6 +29,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlFSharpVs", "src\NpgsqlFSharpVs\NpgsqlFSharpVs.csproj", "{37577282-1289-40DB-AD3D-24499BD09DAE}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "NpgsqlFSharpAnalyzer.Core", "src\NpgsqlFSharpAnalyzer.Core\NpgsqlFSharpAnalyzer.Core.fsproj", "{5964BB56-97B8-4FAE-9933-8113DB11438D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +79,30 @@ Global
{8FC9B600-2A16-4E0C-89D7-F61F5F315F3E}.Release|x64.Build.0 = Release|Any CPU
{8FC9B600-2A16-4E0C-89D7-F61F5F315F3E}.Release|x86.ActiveCfg = Release|Any CPU
{8FC9B600-2A16-4E0C-89D7-F61F5F315F3E}.Release|x86.Build.0 = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|x64.ActiveCfg = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|x64.Build.0 = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|x86.ActiveCfg = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Debug|x86.Build.0 = Debug|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|Any CPU.Build.0 = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|x64.ActiveCfg = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|x64.Build.0 = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|x86.ActiveCfg = Release|Any CPU
{37577282-1289-40DB-AD3D-24499BD09DAE}.Release|x86.Build.0 = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|x64.ActiveCfg = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|x64.Build.0 = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|x86.ActiveCfg = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Debug|x86.Build.0 = Debug|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|Any CPU.Build.0 = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|x64.ActiveCfg = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|x64.Build.0 = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|x86.ActiveCfg = Release|Any CPU
{5964BB56-97B8-4FAE-9933-8113DB11438D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -84,6 +112,8 @@ Global
{AAFC4496-746A-44AC-A4B1-CECC4ADED6CD} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216}
{4CA3F686-DFAB-4AAF-8004-4158E18EF24E} = {ACBEE43C-7A88-4FB1-9B06-DB064D22B29F}
{8FC9B600-2A16-4E0C-89D7-F61F5F315F3E} = {4CA3F686-DFAB-4AAF-8004-4158E18EF24E}
{37577282-1289-40DB-AD3D-24499BD09DAE} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216}
{5964BB56-97B8-4FAE-9933-8113DB11438D} = {C397A34C-84F1-49E7-AEBC-2F9F2B196216}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BC821061-2FB3-4ABD-9FA1-044D4C59C475}
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ Analyzer that provides embedded **SQL syntax analysis** when writing queries usi
- Built-in code fixes for the above
- Ability to write multi-line queries in `[<Literal>]` text and referencing it
- Free (MIT licensed)
- Supports VS Code with [Ionide](https://github.com/ionide/ionide-vscode-fsharp) via F# Analyzers SDK
- Supports Visual Studio

## NuGet

@@ -21,7 +23,24 @@ Analyzer that provides embedded **SQL syntax analysis** when writing queries usi
| NpgsqlFSharpAnalyzer | [![NuGet Badge](https://buildstats.info/nuget/NpgsqlFSharpAnalyzer)](https://www.nuget.org/packages/NpgsqlFSharpAnalyzer/) | [![NuGet Badge](https://buildstats.info/nuget/NpgsqlFSharpAnalyzer?includePreReleases=true)](https://www.nuget.org/packages/NpgsqlFSharpAnalyzer/) |


## Using The Analyzer
## Using The Analyzer (Visual Studio)

### 1 - Configure the connection string to your development database
The analyzer requires a connection string that points to the database you are developing against. You can configure this connection string by either creating a file called `NPGSQL_FSHARP` (without extension) somewhere next to your F# project or preferably in the root of your workspace. This file should contain that connection string and nothing else. An example of the contents of such file:
```
Host=localhost; Username=postgres; Password=postgres; Database=databaseName
```
> Remember to add an entry in your .gitingore file to make sure you don't commit the connection string to your source version control system.
Another way to configure the connection string is by setting the value of an environment variable named `NPGSQL_FSHARP` that contains the connection string.

The analyzer will try to locate and read the file first, then falls back to using the environment variable.

### 2 - Install the Visual Studio Extension

Download the latest version of `NpgsqlFSharpVs.vsix` from the [Releases](https://github.com/Zaid-Ajaj/Npgsql.FSharp.Analyzer/releases) page and double click the extension to install in on your system.

## Using The Analyzer (VS Code)

### 1 - Configure the connection string to your development database
The analyzer requires a connection string that points to the database you are developing against. You can configure this connection string by either creating a file called `NPGSQL_FSHARP` (without extension) somewhere next to your F# project or preferably in the root of your workspace. This file should contain that connection string and nothing else. An example of the contents of such file:
85 changes: 10 additions & 75 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#load ".fake/build.fsx/intellisense.fsx"
#load "docsTool/CLI.fs"
#if !FAKE
#r "Facades/netstandard"
#r "netstandard"
@@ -73,11 +72,6 @@ let distGlob = distDir @@ "*.nupkg"
let coverageThresholdPercent = 1
let coverageReportDir = __SOURCE_DIRECTORY__ @@ "docs" @@ "coverage"


let docsDir = __SOURCE_DIRECTORY__ @@ "docs"
let docsSrcDir = __SOURCE_DIRECTORY__ @@ "docsSrc"
let docsToolDir = __SOURCE_DIRECTORY__ @@ "docsTool"

let releaseNotes = Fake.Core.ReleaseNotes.load "RELEASE_NOTES.md"

let publishUrl = "https://www.nuget.org"
@@ -140,40 +134,6 @@ module dotnet =
let fcswatch optionConfig args =
tool optionConfig "fcswatch" args

open DocsTool.CLIArgs
module DocsTool =
open Argu
let buildparser = ArgumentParser.Create<BuildArgs>(programName = "docstool")
let buildCLI =
[
BuildArgs.ProjectGlob srcGlob
BuildArgs.DocsOutputDirectory docsDir
BuildArgs.DocsSourceDirectory docsSrcDir
BuildArgs.ReleaseVersion releaseNotes.NugetVersion
]
|> buildparser.PrintCommandLineArgumentsFlat

let build () =
dotnet.run (fun args ->
{ args with WorkingDirectory = docsToolDir }
) (sprintf " -- build %s" (buildCLI))
|> failOnBadExitAndPrint

let watchparser = ArgumentParser.Create<WatchArgs>(programName = "docstool")
let watchCLI =
[
WatchArgs.ProjectGlob srcGlob
WatchArgs.DocsSourceDirectory docsSrcDir
WatchArgs.ReleaseVersion releaseNotes.NugetVersion
]
|> watchparser.PrintCommandLineArgumentsFlat

let watch projectpath =
dotnet.watch (fun args ->
{ args with WorkingDirectory = docsToolDir }
) "run" (sprintf "-- watch %s" (watchCLI))
|> failOnBadExitAndPrint

//-----------------------------------------------------------------------------
// Target Implementations
//-----------------------------------------------------------------------------
@@ -195,14 +155,17 @@ let clean _ =
|> Seq.iter Shell.rm

let dotnetRestore _ =
let restoreExitCode = Shell.Exec("dotnet", "restore", __SOURCE_DIRECTORY__)
if restoreExitCode <> 0
then failwith "Restore failed"
()

let dotnetBuild _ =
let buildResult = Shell.Exec("dotnet", "build", __SOURCE_DIRECTORY__)
let build dir =
let buildResult = Shell.Exec("dotnet", "build -c Release", dir)
if buildResult <> 0
then failwith "dotnet build failed"
then failwithf "FAILED %s> dotnet build -c Release" dir

let dotnetBuild _ =
build (__SOURCE_DIRECTORY__ </> "src" </> "NpgsqlFSharpAnalyzer.Core")
build (__SOURCE_DIRECTORY__ </> "src" </> "NpgsqlFSharpAnalyzer")
build (__SOURCE_DIRECTORY__ </> "tests" </> "NpgsqlFSharpAnalyzer.Tests")

let dotnetTest ctx =
let testResult = Shell.Exec("dotnet", "run", "tests" </> "NpgsqlFSharpAnalyzer.Tests")
@@ -340,24 +303,6 @@ let publishToNuget _ =
if exitCode <> 0
then failwith "Could not publish package"

let buildDocs _ =
DocsTool.build ()

let watchDocs _ =
let watchBuild () =
!! srcGlob
|> Seq.map(fun proj -> fun () ->
dotnet.watch
(fun opt ->
opt |> DotNet.Options.withWorkingDirectory (IO.Path.GetDirectoryName proj))
"build"
""
|> ignore
)
|> Seq.iter (invokeAsync >> Async.Catch >> Async.Ignore >> Async.Start)
watchBuild ()
DocsTool.watch ()


//-----------------------------------------------------------------------------
// Target Declaration
@@ -373,8 +318,6 @@ Target.create "GenerateAssemblyInfo" generateAssemblyInfo
Target.create "DotnetPack" dotnetPack
Target.create "PublishToNuGet" publishToNuget
Target.create "Release" ignore
Target.create "BuildDocs" buildDocs
Target.create "WatchDocs" watchDocs

//-----------------------------------------------------------------------------
// Target Dependencies
@@ -390,16 +333,8 @@ Target.create "WatchDocs" watchDocs
"GenerateAssemblyInfo" ?=> "DotnetBuild"
"GenerateAssemblyInfo" ==> "PublishToNuGet"

"DotnetBuild" ==> "BuildDocs"
"BuildDocs" ?=> "PublishToNuget"
"DotnetPack" ?=> "BuildDocs"

"DotnetBuild" ==> "WatchDocs"

"DotnetRestore"
==> "DotnetBuild"
"DotnetBuild"
==> "DotnetTest"
=?> ("GenerateCoverageReport", not disableCodeCoverage)
==> "DotnetPack"
==> "PublishToNuGet"
==> "Release"
3 changes: 0 additions & 3 deletions docsSrc/Explanations/Background.md

This file was deleted.

2 changes: 0 additions & 2 deletions docsSrc/How_Tos/Doing_A_Thing.md

This file was deleted.

2 changes: 0 additions & 2 deletions docsSrc/How_Tos/Doing_Another_Thing.md

This file was deleted.

13 changes: 0 additions & 13 deletions docsSrc/Tutorials/Getting_Started.md

This file was deleted.

5 changes: 0 additions & 5 deletions docsSrc/content/cleanups.js

This file was deleted.

4 changes: 0 additions & 4 deletions docsSrc/content/hotload.js

This file was deleted.

Loading

0 comments on commit dbe65f0

Please sign in to comment.