Skip to content

Commit

Permalink
Merge pull request #2418 from input-output-hk/SCP-1223-prereq
Browse files Browse the repository at this point in the history
A few small tweaks that have dropped out of my SCP-1223 work.
  • Loading branch information
krisajenkins committed Oct 29, 2020
2 parents a1c7e15 + 95d1897 commit 61e5a82
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
41 changes: 21 additions & 20 deletions marlowe-playground-client/src/Halogen/Monaco.purs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ type Objects
, completionItemProvider :: Maybe CompletionItemProvider
}

newtype CancelBindings
= CancelBindings (Effect Unit)

type State
= { editor :: Maybe Editor
, deactivateBindings :: Effect Unit
, deactivateBindings :: CancelBindings
, objects :: Objects
}

Expand Down Expand Up @@ -103,7 +106,7 @@ monacoComponent settings =
{ initialState:
const
{ editor: Nothing
, deactivateBindings: pure unit
, deactivateBindings: CancelBindings $ pure unit
, objects:
{ codeActionProvider: settings.codeActionProvider
, completionItemProvider: settings.completionItemProvider
Expand Down Expand Up @@ -229,28 +232,26 @@ handleQuery (SetModelMarkers markersData f) = do
markers <- Monaco.getModelMarkers monaco model
pure $ f markers

handleQuery (SetKeyBindings DefaultBindings next) =
withEditor \editor -> do
{ deactivateBindings } <- get
liftEffect deactivateBindings
pure next

handleQuery (SetKeyBindings Emacs next) =
withEditor \editor -> do
{ deactivateBindings } <- get
liftEffect deactivateBindings
disableEmacsMode <- liftEffect $ Monaco.enableEmacsBindings editor
modify_ (_ { deactivateBindings = disableEmacsMode })
pure next

handleQuery (SetKeyBindings Vim next) =
handleQuery (SetKeyBindings bindings next) =
withEditor \editor -> do
{ deactivateBindings } <- get
liftEffect deactivateBindings
disableVimMode <- liftEffect $ Monaco.enableVimBindings editor
modify_ (_ { deactivateBindings = disableVimMode })
newDeactivateBindings <- liftEffect $ replaceKeyBindings bindings editor deactivateBindings
modify_ (_ { deactivateBindings = newDeactivateBindings })
pure next

handleQuery (GetObjects f) = do
{ objects } <- get
pure $ Just $ f objects

replaceKeyBindings :: KeyBindings -> Editor -> CancelBindings -> Effect (CancelBindings)
replaceKeyBindings bindings editor (CancelBindings deactivateOldBindings) = do
let
enableFn :: KeyBindings -> Editor -> Effect (Effect Unit)
enableFn DefaultBindings = pure $ pure $ pure unit

enableFn Vim = Monaco.enableVimBindings

enableFn Emacs = Monaco.enableEmacsBindings
deactivateOldBindings
deactivateNewBindings <- enableFn bindings editor
pure $ CancelBindings deactivateNewBindings
2 changes: 1 addition & 1 deletion marlowe-playground-client/src/Monaco.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ exports.enableEmacsBindings_ = function (editor) {
}

exports.completionItemKindEq_ = function (a, b) {
a == b
return a == b;
}

exports.completionItemKindOrd_ = function (lt, eq, gt, a, b) {
Expand Down
4 changes: 2 additions & 2 deletions playground-common/src/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ authStatus cookieHeader = do
"Failed to extract github token at step: " <> showText err
pure Anonymous
let authStatusResult = AuthStatus {..}
logDebugN $ "Authentication status is:" <> showText authStatusResult
logDebugN $ "Authentication status is: " <> showText authStatusResult
pure authStatusResult

extractGithubToken ::
Expand All @@ -233,7 +233,7 @@ extractGithubToken signer now cookieHeader =
Map.lookup githubTokenClaim .
JWT.unClaimsMap . JWT.unregisteredClaims $
claims
attempt $ "Extracting token as a string:" <> showText json
attempt $ "Extracting token as a string: " <> showText json
withTrace $
case json of
String token -> pure $ Token token
Expand Down
2 changes: 1 addition & 1 deletion plutus-playground-client/src/Chain.purs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ emulatorEventPane (ChainEvent (TxnValidate (TxId txId))) =

emulatorEventPane (NotificationEvent notificationEvent) =
div_
[ text $ "Notification event:" <> show notificationEvent ]
[ text $ "Notification event: " <> show notificationEvent ]

emulatorEventPane (ChainEvent (TxnValidationFail (TxId txId) error)) =
div [ class_ $ ClassName "error" ]
Expand Down
4 changes: 0 additions & 4 deletions plutus-playground-client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');

const isWebpackDevServer = process.argv.some(a => path.basename(a) === 'webpack-dev-server');

Expand Down Expand Up @@ -94,9 +93,6 @@ module.exports = {
},

plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
}),
new HtmlWebpackPlugin({
template: '../web-common/static/index.html',
favicon: 'static/favicon.ico',
Expand Down
2 changes: 1 addition & 1 deletion plutus-scb/test/Plutus/SCB/CoreSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ assertEqual msg expected actual =
$ Text.unwords
[ msg
, "Expected: " <> tshow expected
, "Actual:" <> tshow actual
, "Actual: " <> tshow actual
]

assertBool ::
Expand Down

0 comments on commit 61e5a82

Please sign in to comment.