10 max-stack-items set-global
-SYMBOL: error-summary-hook
+SYMBOL: error-summary?
<PRIVATE
in get auto-use? get [ " - auto" append ] when "( " " )" surround
H{ { background T{ rgba f 1 0.7 0.7 1 } } } format bl flush ;
-[ error-summary ] error-summary-hook set-global
-
-: call-error-summary-hook ( -- )
- error-summary-hook get call( -- ) ;
-
:: (listener) ( datastack -- )
- call-error-summary-hook
+ error-summary? get [ error-summary ] when
visible-vars.
datastack datastack.
prompt.
M: source-file-error error.
[ summary print nl ]
- [ "Asset: " write asset>> short. nl ]
+ [ asset>> [ "Asset: " write short. nl ] when* ]
[ error>> error. ]
tri ;
--- /dev/null
+Slava Pestov
\ No newline at end of file
--- /dev/null
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: models source-files.errors namespaces models.delay init
+kernel calendar ;
+IN: tools.errors.model
+
+SYMBOLS: (error-list-model) error-list-model ;
+
+(error-list-model) [ f <model> ] initialize
+
+error-list-model [ (error-list-model) get-global 100 milliseconds <delay> ] initialize
+
+SINGLETON: updater
+
+M: updater errors-changed drop f (error-list-model) get-global set-model ;
+
+[ updater add-error-observer ] "ui.tools.error-list" add-init-hook
+
combinators combinators.smart combinators.short-circuit editors make
memoize compiler.units fonts kernel io.pathnames prettyprint
source-files.errors math.parser init math.order models models.arrow
-models.arrow.smart models.search models.mapping models.delay debugger
+models.arrow.smart models.search models.mapping debugger
namespaces summary locals ui ui.commands ui.gadgets ui.gadgets.panes
ui.gadgets.tables ui.gadgets.labeled ui.gadgets.tracks ui.gestures
ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers
ui.tools.inspector ui.gadgets.status-bar ui.operations
ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs
ui.gadgets.labels ui.baseline-alignment ui.images ui.tools.listener
-compiler.errors calendar tools.errors ;
+compiler.errors tools.errors tools.errors.model ;
IN: ui.tools.error-list
CONSTANT: source-file-icon
{ T{ key-down f f "F1" } error-list-help }
} define-command-map
-SYMBOL: error-list-model
-
-error-list-model [ f <model> ] initialize
-
-SINGLETON: updater
-
-M: updater errors-changed
- drop f error-list-model get-global set-model ;
-
-[ updater add-error-observer ] "ui.tools.error-list" add-init-hook
-
-: <error-list-model> ( -- model )
- error-list-model get-global
- 1/2 seconds <delay> [ drop all-errors ] <arrow> ;
-
: error-list-window ( -- )
- <error-list-model> <error-list-gadget> "Errors" open-status-window ;
+ error-list-model get [ drop all-errors ] <arrow>
+ <error-list-gadget> "Errors" open-status-window ;
: show-error-list ( -- )
[ error-list-gadget? ] find-window
ui.gadgets.status-bar ui.gadgets.tracks ui.gadgets.borders ui.gestures
ui.operations ui.tools.browser ui.tools.common ui.tools.debugger
ui.tools.listener.completion ui.tools.listener.popups
-ui.tools.listener.history ui.tools.error-list ui.images ;
+ui.tools.listener.history ui.images ui.tools.error-list tools.errors.model ;
FROM: source-files.errors => all-errors ;
IN: ui.tools.listener
[ >>input ] [ pane new-pane t >>scrolls? >>output ] bi
dup listener-streams >>output drop ;
+: error-summary. ( -- )
+ error-counts keys [
+ H{ { table-gap { 3 3 } } } [
+ [ [ [ icon>> write-image ] with-cell ] each ] with-row
+ ] tabular-output
+ { "Press " { $command tool "common" show-error-list } " to view errors." }
+ print-element
+ ] unless-empty ;
+
: <error-summary> ( -- gadget )
- <pane> COLOR: light-yellow <solid> >>interior ;
+ error-list-model get [ drop error-summary. ] <pane-control>
+ COLOR: light-yellow <solid> >>interior ;
: init-error-summary ( listener -- listener )
<error-summary> >>error-summary
{ T{ key-down f { C+ } "r" } history-completion-popup }
} define-command-map
-: error-summary. ( listener -- )
- error-summary>> [
- error-counts keys [
- H{ { table-gap { 3 3 } } } [
- [ [ [ icon>> write-image ] with-cell ] each ] with-row
- ] tabular-output
- { "Press " { $command tool "common" show-error-list } " to view errors." }
- print-element
- ] unless-empty
- ] with-pane ;
-
: listener-thread ( listener -- )
dup listener-streams [
[ com-browse ] help-hook set
- [ '[ [ _ input>> ] 2dip debugger-popup ] error-hook set ]
- [ '[ _ error-summary. ] error-summary-hook set ] bi
+ '[ [ _ input>> ] 2dip debugger-popup ] error-hook set
+ error-summary? off
tip-of-the-day. nl
listener
] with-streams* ;