Skip to content

Commit

Permalink
feat: buildAndRun
Browse files Browse the repository at this point in the history
  • Loading branch information
gretmn102 committed Aug 5, 2020
1 parent b014003 commit cf9eca9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 3 additions & 3 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,13 @@ NUGET
FSharp.Core (>= 4.3.4) - restriction: >= netstandard2.0
GIT
remote: https://github.com/gretmn102/FParserQSP
(a89204f7f2705ba3b31ff77ca62af9a82bb42477)
(794c215440f7ce52de773ffdf781e671f1580c1d)
build: build.cmd
os: win
(a89204f7f2705ba3b31ff77ca62af9a82bb42477)
(794c215440f7ce52de773ffdf781e671f1580c1d)
build: build.sh
os: linux
(a89204f7f2705ba3b31ff77ca62af9a82bb42477)
(794c215440f7ce52de773ffdf781e671f1580c1d)
build: build.sh
os: osx
GITHUB
Expand Down
4 changes: 4 additions & 0 deletions release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
{
"command": "extension.build",
"title": "QSP: Build"
},
{
"command": "extension.buildAndRun",
"title": "QSP: Build and run"
}
],
"semanticTokenScopes": [
Expand Down
13 changes: 11 additions & 2 deletions src/Core/LanguageService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,14 @@ Consider:
opt
window.createTextEditorDecorationType decorationType

let buildQsp () =
let buildQspGen cmd =
let editor = vscode.window.activeTextEditor
editor.document.save()
|> Promise.bind (fun isSaved ->
if isSaved then
client
|> Option.map (fun client ->
client.sendRequest("qsp/build", editor.document.uri.fsPath)
client.sendRequest(cmd, editor.document.uri.fsPath)
|> Promise.bind (fun res ->
// Ну и зачем так делать? Не проще ли было сделать какой-нибудь преобразователь с Newtonsoft.Json в Fable.Core.JsInterop и обратно? Идиотизм какой-то.
let case : string = res?case |> unbox
Expand All @@ -593,6 +593,9 @@ Consider:
Promise.empty
)

let buildQsp () = buildQspGen "qsp/build"
let buildQspAndRun () = buildQspGen "qsp/buildAndRun"

let readyClient (ctx : ExtensionContext) (cl: LanguageClient) =
cl.onReady ()
|> Promise.onSuccess (fun _ ->
Expand Down Expand Up @@ -652,6 +655,12 @@ Consider:
|> unbox<Func<obj, obj>>
)
ctx.subscriptions.Add(disposable)
let disposable =
vscode.commands.registerCommand("extension.buildAndRun",
buildQspAndRun
|> unbox<Func<obj, obj>>
)
ctx.subscriptions.Add(disposable)

// vscode.window.showInformationMessage "client is ready" |> ignore
()
Expand Down

0 comments on commit cf9eca9

Please sign in to comment.