Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marlowe Playground Frontend: Separate simulator from marlowe editor #2560

Merged
merged 28 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c292b3a
Created a new view for MarloweEditor
hrajchert Dec 11, 2020
aa11123
Fixed keybinding selector for marlowe editor
hrajchert Dec 15, 2020
9aa0b45
Moved linter, holes and initial marker logic from simulation to marlo…
hrajchert Dec 15, 2020
5ab6c74
Fix double provider information
hrajchert Dec 17, 2020
0b8709a
Renamed Simulation modules
hrajchert Dec 18, 2020
01d7715
Separated simulation bottom panel and actions
hrajchert Dec 21, 2020
0df178e
Fix bottom panel in marlowe editor
hrajchert Dec 22, 2020
b965b65
Fix rebasing problems
hrajchert Dec 22, 2020
f040f8b
Fix simulation language color
hrajchert Dec 24, 2020
7525b68
Make the simulation editor readonly
hrajchert Dec 24, 2020
e4ccd72
Renamed _marloweEditorSlot to _simulatorEditorSlot
hrajchert Dec 24, 2020
22172d9
Remove unused imports
hrajchert Dec 24, 2020
d654ac2
Reimplement workflow buttons
hrajchert Dec 28, 2020
641554f
Move select hole to MarloweEditor
hrajchert Dec 28, 2020
371a512
Fix simulation state on refresh
hrajchert Dec 28, 2020
e83d0a7
Remove unused code from simulation bottom panel
hrajchert Dec 28, 2020
d3c1f67
Remove unused code from Marlowe editor bottom panel
hrajchert Dec 28, 2020
dc7f9ca
redesign simulation right pane
hrajchert Dec 29, 2020
b03037d
Remove obsolete FIXMEs
hrajchert Dec 30, 2020
4d75cb5
Applied PR suggestions
hrajchert Dec 30, 2020
a342fae
Fix rebasing problems
hrajchert Dec 30, 2020
4ebcd1e
Fix file actions not being shown in Marlowe editor
hrajchert Dec 30, 2020
69c951f
Added comment on linter
hrajchert Dec 30, 2020
68a36aa
Remove isValidContract from the simulation as it should always be valid
hrajchert Dec 30, 2020
5acb88e
resolved small fixme
hrajchert Dec 30, 2020
3fafe7b
Applied purty
hrajchert Dec 30, 2020
d3751e7
Fix undo button problem
hrajchert Dec 30, 2020
ab1b119
Improved how we show a slot range
hrajchert Dec 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix double provider information
  • Loading branch information
hrajchert authored and shmish111 committed Jan 5, 2021
commit 5ab6c74f69dccaed9b2e3f9f07763c28ba587369
9 changes: 8 additions & 1 deletion marlowe-playground-client/src/MarloweEditor/State.purs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ handleAction _ (HandleEditorMessage (Monaco.TextChanged text)) = do
(Tuple markerData additionalContext) = Linter.markers unreachableContracts parsedContract
markers <- query _marloweEditorPageSlot unit (Monaco.SetModelMarkers markerData identity)
void $ traverse editorSetMarkers markers
hrajchert marked this conversation as resolved.
Show resolved Hide resolved
-- QUESTION: Why do we need to update providers on every text change?
{-
There are three different Monaco objects that require the linting information:
* Markers
* Code completion (type aheads)
* Code suggestions (Quick fixes)
To avoid having to recalculate the linting multiple times, we add aditional context to the providers
whenever the code changes.
-}
providers <- query _marloweEditorPageSlot unit (Monaco.GetObjects identity)
case providers of
Just { codeActionProvider: Just caProvider, completionItemProvider: Just ciProvider } -> pure $ updateAdditionalContext caProvider ciProvider additionalContext
Expand Down
25 changes: 21 additions & 4 deletions marlowe-playground-client/src/Simulation.purs
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,21 @@ import Halogen.HTML.Events (onClick, onSelectedIndexChange, onValueChange)
import Halogen.HTML.Properties (InputType(..), alt, class_, classes, enabled, placeholder, src, type_, value)
import Halogen.HTML.Properties as HTML
import Halogen.Monaco (Message(..), Query(..)) as Monaco
import Halogen.Monaco (monacoComponent)
import Halogen.Monaco (Settings, monacoComponent)
import Help (HelpContext(..), toHTML)
import Language.Haskell.Monaco (languageExtensionPoint, refLabel)
import LocalStorage as LocalStorage
import MainFrame.Types (ChildSlots, _hasUnsavedChanges', _marloweEditorSlot)
import Marlowe (SPParams_)
import Marlowe as Server
import Marlowe.Holes (fromTerm)
import Marlowe.Linter as Linter
import Marlowe.Monaco (updateAdditionalContext)
import Marlowe.Monaco (daylightTheme, updateAdditionalContext)
import Marlowe.Monaco as MM
import Marlowe.Parser (parseContract)
import Marlowe.Semantics (AccountId, Bound(..), ChoiceId(..), Input(..), Party(..), PubKey, Token, emptyState, inBounds, showPrettyToken)
import Marlowe.Symbolic.Types.Request as MSReq
import Monaco (IMarker, isError, isWarning)
import Monaco (Editor, IMarker, isError, isWarning)
import Monaco (getModel, getMonaco, setTheme, setValue) as Monaco
import Network.RemoteData (RemoteData(..))
import Network.RemoteData as RemoteData
Expand Down Expand Up @@ -552,7 +553,23 @@ marloweEditor state = slot _marloweEditorSlot unit component unit (Just <<< Hand
monaco <- Monaco.getMonaco
Monaco.setTheme monaco MM.daylightTheme.name

component = monacoComponent $ MM.settings setup
component = monacoComponent $ settings setup

-- FIXME while doing the refactor this settigns were colliding with the marlowe. Delete
settings :: forall m. (Editor -> m Unit) -> Settings m
settings setup =
{ languageExtensionPoint
, theme: Just daylightTheme
, monarchTokensProvider: Nothing
, tokensProvider: Nothing
, hoverProvider: Nothing
, completionItemProvider: Nothing
, codeActionProvider: Nothing
, documentFormattingEditProvider: Nothing
, refLabel
, owner: "marloweEditor"
, setup
}

sidebar ::
forall p.
Expand Down
14 changes: 7 additions & 7 deletions marlowe-playground-client/src/Simulation/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ type State
-- FIXME: Remove selectedHole
, selectedHole :: Maybe String
, oldContract :: Maybe String
, source :: Lang
, source :: Lang -- FIXME: change to Workflow (and probably in the MainFrame)
, hasUnsavedChanges :: Boolean
}

Expand Down Expand Up @@ -421,7 +421,7 @@ isContractValid state =

data Action
= Init
-- editor
-- editor (FIXME to MarloweEditor)
| HandleEditorMessage Monaco.Message
| HandleDragEvent DragEvent
| HandleDropEvent DragEvent
Expand All @@ -431,7 +431,7 @@ data Action
| SetEditorText String
| InitMarloweProject String
| MarkProjectAsSaved
-- marlowe actions
-- marlowe actions (FIXME to SimulationPage)
| SetInitialSlot Slot
| StartSimulation
| MoveSlot Slot
Expand All @@ -442,19 +442,19 @@ data Action
| ResetContract
| ResetSimulator
| Undo
| SelectHole (Maybe String)
| SelectHole (Maybe String) -- FIXME (check, but most likely MarloweEditor)
-- simulation view
| ChangeSimulationView BottomPanelView
| ChangeHelpContext HelpContext
| ShowRightPanel Boolean
| ShowBottomPanel Boolean
| ShowErrorDetail Boolean
-- Editors
-- Editors -- FIXME: split to both
| SetBlocklyCode
| EditHaskell
| EditHaskell -- FIXME: change to EditSource (and use Workflow)
| EditJavascript
| EditActus
-- websocket
-- websocket -- FIXME to MarloweEditor
| AnalyseContract
| AnalyseReachabilityContract
| Save
Expand Down