Skip to content

Commit

Permalink
Update to vscode-languageclient 8 (#1713)
Browse files Browse the repository at this point in the history
* most of the things

* minimal changes

* add null coalescing support

* try to load vscode dependencies as well

* update webpack and remove unnecessary babel loader dependency
  • Loading branch information
baronfel committed Jul 11, 2022
1 parent f9f7346 commit 1738c15
Show file tree
Hide file tree
Showing 27 changed files with 943 additions and 3,562 deletions.
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
]
},
"fable": {
"version": "3.7.8",
"version": "3.7.11",
"commands": [
"fable"
]
},
"fantomas-tool": {
"version": "4.7.0",
"fantomas": {
"version": "5.0.0-alpha-007",
"commands": [
"fantomas"
]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
# need to add linux commands first
os: [windows-latest, macos-latest]
dotnet: [6.0.101]
fail-fast: false # we have timing issues on some OS, so we want them all to run
runs-on: ${{ matrix.os }}

steps:
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@
"semver": "^7.3.5"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@types/semver": "^7.3.8",
"@types/showdown": "^1.9.3",
"@types/vscode": "^1.52.0",
"@types/ws": "^7.2.6",
"axios": "^0.20.0",
"babel-loader": "^8.1.0",
"mocha": "^8.1.3",
"showdown": "^1.9.1",
"toml": "^3.0.0",
"ts2fable": "^0.8.0-build.618",
"vscode-debugadapter": "^1.44.0",
"vscode-languageclient": "^7.0.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"vscode-languageclient": "^8.0.0",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"ws": "^7.3.1",
"xhr2": "^0.2.0",
"xmldom": "^0.6.0",
Expand Down
68 changes: 33 additions & 35 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NUGET
Fable.Browser.Event (>= 1.5)
Fable.Core (>= 3.0)
FSharp.Core (>= 4.7.2)
Fable.Core (3.6.2)
Fable.Core (3.7.1)
Fable.HtmlConverter (2.1)
Fable.Core (>= 3.1.5)
Thoth.Json (>= 4.1)
Expand All @@ -32,19 +32,19 @@ NUGET
Fable.Promise (3.1.3)
Fable.Core (>= 3.1.5)
FSharp.Core (>= 4.7.2)
FSharp.Core (6.0.3)
FSharp.Core (6.0.4)
Thoth.Json (7.0)
Fable.Core (>= 3.1.6)
FSharp.Core (>= 4.7.2)
GIT
remote: https://github.com/ionide/ionide-fsgrammar.git
(8825a76681cdc14801b5d9490372ff67ec6b9711)
(33c42ce4b0960c86837a978fa06c45bc3dec0521)
GITHUB
remote: ionide/ionide-vscode-helpers
src/Fable.Import.Showdown.fs (6ed5341be68452af4f93f7c6e462cdfb58dd0464)
src/Fable.Import.VSCode.fs (6ed5341be68452af4f93f7c6e462cdfb58dd0464)
src/Fable.Import.VSCode.LanguageServer.fs (6ed5341be68452af4f93f7c6e462cdfb58dd0464)
src/Helpers.fs (6ed5341be68452af4f93f7c6e462cdfb58dd0464)
src/Fable.Import.Showdown.fs (8d2fca6c1d49172bdd50b3fcdd6a5d66019dffd0)
src/Fable.Import.VSCode.fs (8d2fca6c1d49172bdd50b3fcdd6a5d66019dffd0)
src/Fable.Import.VSCode.LanguageServer.fs (8d2fca6c1d49172bdd50b3fcdd6a5d66019dffd0)
src/Helpers.fs (8d2fca6c1d49172bdd50b3fcdd6a5d66019dffd0)
GROUP build
STORAGE: NONE
RESTRICTION: == net6.0
Expand Down Expand Up @@ -174,12 +174,12 @@ NUGET
FSharp.Core (>= 6.0)
FParsec (1.1.1)
FSharp.Core (>= 4.3.4)
FSharp.Control.Reactive (5.0.2)
FSharp.Control.Reactive (5.0.5)
FSharp.Core (>= 4.7.2)
System.Reactive (>= 5.0)
FSharp.Core (6.0.3)
Microsoft.Build (17.1)
Microsoft.Build.Framework (>= 17.1)
System.Reactive (>= 5.0 < 6.0)
FSharp.Core (6.0.4)
Microsoft.Build (17.2)
Microsoft.Build.Framework (>= 17.2)
Microsoft.NET.StringTools (>= 1.0)
Microsoft.Win32.Registry (>= 4.3)
System.Collections.Immutable (>= 5.0)
Expand All @@ -189,12 +189,12 @@ NUGET
System.Text.Encoding.CodePages (>= 4.0.1)
System.Text.Json (>= 6.0)
System.Threading.Tasks.Dataflow (>= 6.0)
Microsoft.Build.Framework (17.1)
Microsoft.Build.Framework (17.2)
Microsoft.Win32.Registry (>= 4.3)
System.Security.Permissions (>= 4.7)
Microsoft.Build.Tasks.Core (17.1)
Microsoft.Build.Framework (>= 17.1)
Microsoft.Build.Utilities.Core (>= 17.1)
Microsoft.Build.Tasks.Core (17.2)
Microsoft.Build.Framework (>= 17.2)
Microsoft.Build.Utilities.Core (>= 17.2)
Microsoft.NET.StringTools (>= 1.0)
Microsoft.Win32.Registry (>= 4.3)
System.CodeDom (>= 4.4)
Expand All @@ -205,14 +205,12 @@ NUGET
System.Security.Cryptography.Xml (>= 4.7)
System.Security.Permissions (>= 4.7)
System.Threading.Tasks.Dataflow (>= 6.0)
Microsoft.Build.Utilities.Core (17.1)
Microsoft.Build.Framework (>= 17.1)
Microsoft.Build.Utilities.Core (17.2)
Microsoft.Build.Framework (>= 17.2)
Microsoft.NET.StringTools (>= 1.0)
Microsoft.Win32.Registry (>= 4.3)
System.Collections.Immutable (>= 5.0)
System.Configuration.ConfigurationManager (>= 4.7)
System.Security.Permissions (>= 4.7)
System.Text.Encoding.CodePages (>= 4.0.1)
Microsoft.NET.StringTools (1.0)
System.Memory (>= 4.5.4)
System.Runtime.CompilerServices.Unsafe (>= 5.0)
Expand All @@ -221,27 +219,27 @@ NUGET
System.Security.Principal.Windows (>= 5.0)
Microsoft.Win32.SystemEvents (6.0.1)
Mono.Posix.NETStandard (1.0)
MSBuild.StructuredLogger (2.1.630)
MSBuild.StructuredLogger (2.1.669)
Microsoft.Build (>= 16.10)
Microsoft.Build.Framework (>= 16.10)
Microsoft.Build.Tasks.Core (>= 16.10)
Microsoft.Build.Utilities.Core (>= 16.10)
Newtonsoft.Json (13.0.1)
NuGet.Common (6.1)
NuGet.Frameworks (>= 6.1)
NuGet.Configuration (6.1)
NuGet.Common (>= 6.1)
NuGet.Common (6.2)
NuGet.Frameworks (>= 6.2)
NuGet.Configuration (6.2)
NuGet.Common (>= 6.2)
System.Security.Cryptography.ProtectedData (>= 4.4)
NuGet.Frameworks (6.1)
NuGet.Packaging (6.1)
NuGet.Frameworks (6.2)
NuGet.Packaging (6.2)
Newtonsoft.Json (>= 13.0.1)
NuGet.Configuration (>= 6.1)
NuGet.Versioning (>= 6.1)
NuGet.Configuration (>= 6.2)
NuGet.Versioning (>= 6.2)
System.Security.Cryptography.Cng (>= 5.0)
System.Security.Cryptography.Pkcs (>= 5.0)
NuGet.Protocol (6.1)
NuGet.Packaging (>= 6.1)
NuGet.Versioning (6.1)
NuGet.Protocol (6.2)
NuGet.Packaging (>= 6.2)
NuGet.Versioning (6.2)
Octokit (0.49)
System.CodeDom (6.0)
System.Collections.Immutable (6.0)
Expand All @@ -252,7 +250,7 @@ NUGET
System.Drawing.Common (6.0)
Microsoft.Win32.SystemEvents (>= 6.0)
System.Formats.Asn1 (6.0)
System.Memory (4.5.4)
System.Memory (4.5.5)
System.Reactive (5.0)
System.Reflection.Metadata (6.0.1)
System.Collections.Immutable (>= 6.0)
Expand All @@ -261,7 +259,7 @@ NUGET
System.Security.AccessControl (6.0)
System.Security.Cryptography.Cng (5.0)
System.Formats.Asn1 (>= 5.0)
System.Security.Cryptography.Pkcs (6.0)
System.Security.Cryptography.Pkcs (6.0.1)
System.Formats.Asn1 (>= 6.0)
System.Security.Cryptography.ProtectedData (6.0)
System.Security.Cryptography.Xml (6.0)
Expand All @@ -275,7 +273,7 @@ NUGET
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Text.Encodings.Web (6.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Text.Json (6.0.3)
System.Text.Json (6.0.4)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Text.Encodings.Web (>= 6.0)
System.Threading.Tasks.Dataflow (6.0)
Expand Down
5 changes: 1 addition & 4 deletions src/Components/CodeLensHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ open System
open Fable.Core.JsInterop
open Fable.Import.VSCode
open Fable.Import.VSCode.Vscode
open global.Node

module node = Node.Api

module CodeLensHelpers =

let showReferences (args: string) (args2: obj) (args3: obj []) =
let showReferences (args: string) (args2: obj) (args3: obj[]) =
let uri = vscode.Uri.parse args
let pos = vscode.Position.Create(!!args2?Line, !!args2?Character)

Expand Down
34 changes: 20 additions & 14 deletions src/Components/Debugger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module Debugger =

let debuggerRuntime project = Some "coreclr"

let debugProject (project: Project) (args: string []) =
let debugProject (project: Project) (args: string[]) =
promise {
//TODO check if portablepdb, require info from FSAC

Expand Down Expand Up @@ -158,13 +158,11 @@ module Debugger =
promise {
match Project.getLoaded () with
| [] -> return None
| project::[] -> return Some project
| project :: [] -> return Some project
| projects ->
let picks =
projects
|> List.map (fun p ->
createObj [ "data" ==> p
"label" ==> p.Project ])
|> List.map (fun p -> createObj [ "data" ==> p; "label" ==> p.Project ])
|> ResizeArray

let! proj = window.showQuickPick (unbox<U2<ResizeArray<QuickPickItem>, _>> picks)
Expand Down Expand Up @@ -198,7 +196,7 @@ module Debugger =
abstract member Item: string -> 't

[<Emit("Object.keys($0)")>]
abstract member Keys: string []
abstract member Keys: string[]

[<Interface>]
type LaunchSettingsConfiguration =
Expand Down Expand Up @@ -268,35 +266,42 @@ module Debugger =
c.request <- "launch"
c?program <- projectExecutable
c?args <- cliArgs

match buildTaskOpt with
| Some bt -> c?preLaunchTask <- $"Build: {bt.name}"
| None -> ()

c?cwd <- ls.workingDirectory
|> Option.defaultValue "${workspaceFolder}"
c?cwd <-
ls.workingDirectory
|> Option.defaultValue "${workspaceFolder}"



match ls.launchBrowser with
| Some true ->
c?serverReadyAction <- {| action = "openExternally"
pattern = "\\bNow listening on:\\s+(https?://\\S+)" |} // TODO: make this pattern extendable?
c?serverReadyAction <-
{| action = "openExternally"
pattern = "\\bNow listening on:\\s+(https?://\\S+)" |} // TODO: make this pattern extendable?
| _ -> ()

if JS.isDefined ls.environmentVariables then
let vars =
ls.environmentVariables.Keys
|> Array.choose (fun k ->
let value = ls.environmentVariables[k]

if JS.isDefined value then
let replaced = Environment.expand value
Some (k, box replaced)
else None
)
Some(k, box replaced)
else
None)

c?env <- createObj vars

if not (JS.isDefined ls.environmentVariables["ASPNETCORE_URLS"]) && Option.isSome ls.applicationUrl then
if
not (JS.isDefined ls.environmentVariables["ASPNETCORE_URLS"])
&& Option.isSome ls.applicationUrl
then
c?env?ASPNETCORE_URLS <- ls.applicationUrl.Value

c?console <- "internalConsole"
Expand Down Expand Up @@ -335,6 +340,7 @@ module Debugger =

c?console <- "internalConsole"
c?stopAtEntry <- false

match buildTaskOpt with
| Some bt -> c?preLaunchTask <- $"Build: {bt.name}"
| None -> ()
Expand Down
12 changes: 7 additions & 5 deletions src/Components/FSharpLiterate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,15 @@ module FSharpLiterate =
| Some p -> p.reveal (!! -2, true)
| None ->
let opts =
createObj [ "enableCommandUris" ==> true
"enableFindWidget" ==> true
"retainContextWhenHidden" ==> true ]
createObj
[ "enableCommandUris" ==> true
"enableFindWidget" ==> true
"retainContextWhenHidden" ==> true ]

let viewOpts =
createObj [ "preserveFocus" ==> true
"viewColumn" ==> -2 ]
createObj
[ "preserveFocus" ==> true
"viewColumn" ==> -2 ]

let p =
window.createWebviewPanel ("fsharpLiterate", "F# Literate", !!viewOpts, opts)
Expand Down
18 changes: 9 additions & 9 deletions src/Components/FakeTargetsOutline.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module FakeTargetsOutline =
| DependencyModel of DependencyType

type Model =
{ AllTargets: Target []
{ AllTargets: Target[]
Label: string
Description: string
Declaration: Declaration option
Expand Down Expand Up @@ -117,11 +117,11 @@ module FakeTargetsOutline =
Some
<| getIconPath "auto-reveal-light.svg" "auto-reveal-dark.svg"

let tryFindTarget (allTargets: Target []) (name: string) =
let tryFindTarget (allTargets: Target[]) (name: string) =
allTargets
|> Seq.tryFind (fun t -> t.Name.ToLowerInvariant() = name.ToLowerInvariant())

let rec depAsModel (allTargets: Target []) (t: DependencyType) (d: Dependency) =
let rec depAsModel (allTargets: Target[]) (t: DependencyType) (d: Dependency) =
let mutable children = None

{ AllTargets = allTargets
Expand All @@ -147,7 +147,7 @@ module FakeTargetsOutline =
children <- Some n
n }

and targetAsModel (allTargets: Target []) (t: Target) =
and targetAsModel (allTargets: Target[]) (t: Target) =
let mutable children = None

{ AllTargets = allTargets
Expand Down Expand Up @@ -380,7 +380,7 @@ module FakeTargetsOutline =
window.onDidChangeActiveTextEditor.Invoke(unbox onDidChangeActiveTextEditor)
|> context.Subscribe

refresh.event.Invoke (fun uri ->
refresh.event.Invoke(fun uri ->
if isEnabledFor uri then
reallyRefresh.fire (None)

Expand All @@ -400,8 +400,9 @@ module FakeTargetsOutline =
let line = decl.Line

let args =
createObj [ "lineNumber" ==> line
"at" ==> "center" ]
createObj
[ "lineNumber" ==> line
"at" ==> "center" ]

commands.executeCommand ("revealLine", Some(box args))
|> unbox
Expand Down Expand Up @@ -482,8 +483,7 @@ module FakeTargetsOutline =
let procExp =
vscode.ProcessExecution.Create(
dotnet,
ResizeArray [| yield fakeRuntime
yield! args |],
ResizeArray [| yield fakeRuntime; yield! args |],
opts
)

Expand Down
Loading

0 comments on commit 1738c15

Please sign in to comment.