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

Add inFront parameter to getMarkers #38

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion example/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Ace.Editor as Editor
import Ace.Ext.LanguageTools as LanguageTools
import Ace.Ext.LanguageTools.Completer as Completer
import Ace.KeyBinding as KeyBinding
import Ace.Marker as Marker
import Ace.Range as Range
import Ace.ScrollBar as ScrollBar
import Ace.Search as Search
Expand All @@ -20,7 +21,7 @@ import Ace.TokenIterator as TokenIterator
import Ace.UndoManager as UndoManager
import Data.Array.ST as AST
import Data.Maybe (Maybe(..))
import Data.Traversable (for_)
import Data.Traversable (for_, traverse)
import Effect (Effect)
import Effect.Console (log)
import Effect.Ref as Ref
Expand Down Expand Up @@ -352,6 +353,9 @@ miscTests = void do
_ <- Session.documentToScreenColumn 0 0 session
_ <- Session.documentToScreenRow 0 0 session
_ <- Session.getScreenLength session
markers <- Session.getMarkers false session
markerIds <- traverse Marker.getId markers
log $ "markers " <> show markerIds

Editor.selectMoreLines 0 editor
Editor.setKeyboardHandler "" editor
Expand Down
4 changes: 2 additions & 2 deletions src/Ace/EditSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ exports.createImpl = create;

exports.createFromLinesImpl = create;

exports.getMarkers = function (session) {
exports.getMarkersImpl = function (inFront, session) {
return function () {
var markerObj = session.getMarkers();
var markerObj = session.getMarkers(inFront);
var ks = Object.getOwnPropertyNames(markerObj);
var result = [];
for (var i = 0; i < ks.length; i++) {
Expand Down
5 changes: 3 additions & 2 deletions src/Ace/EditSession.purs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ foreign import createFromLinesImpl :: Fn2 (Array String) (Nullable String) (Effe
createFromLines :: Array String -> Maybe String -> Effect EditSession
createFromLines text mode' = runFn2 createFromLinesImpl text (toNullable mode')

foreign import getMarkersImpl :: Fn2 Boolean EditSession (Effect (Array Marker))

foreign import getMarkers
:: EditSession -> Effect (Array Marker)
getMarkers :: Boolean -> EditSession -> Effect (Array Marker)
getMarkers inFront session = runFn2 getMarkersImpl inFront session