Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Incorrect deprecate warning when MarkerLayer::markRange passed persistent options #154

Closed

Description

@t9md

I'm working on Atom master branch to catch-up display-layer.
cc @as-cii

Then I noticed this warning.

  Assigning custom properties to a marker when creating/copying it is
  deprecated. Please, consider storing the custom properties you need in
  some other object in your package, keyed by the marker's id property.

Only following code shows warning.

  editor.markBufferRange editor.getSelectedBufferRange(),
    invalidate: 'never'
    persistent: false

As far as I check, persistent option is for MarkerLayer but this options is validated by Marker's Marker.extractParams(options).
Should delete options.persitent before passing Marker.extractParams()?

Activity

  1. as-cii commented on May 6, 2016

    @as-cii
    Contributor

    With #149 we have basically moved all the concerns about markers' lifetime and persistence to marker layers and, as a result, passing that option won't actually persist the marker across reloads. This is how the new API looks like (you can also take a look at some of the core packages, like bookmarks, to see how we've switched to marker layers):

    let markerLayer = editor.addMarkerLayer({persistent: true})
    markerLayer.markRange(position)

    You can also optionally pass a maintainHistory parameter to addMarkerLayer which, when true, makes sure to restore your markers when undo or redos are performed.

  2. t9md commented on May 6, 2016

    @t9md
    ContributorAuthor

    Thanks, understood.
    So this api doc has to be updated, it says accept persistent options, but @defaultMarkerLayer is created without any options(@defaultMarkerLayer = @displayLayer.addMarkerLayer())
    https://github.com/atom/atom/blob/master/src/text-editor.coffee#L1691-L1724

    Also TextEditor::markScreenRange has to be updated.

  3. as-cii commented on May 6, 2016

    @as-cii
    Contributor

    Thanks for the heads-up, @t9md! 🙇 I'll make sure to update those docs as soon as possible. 📜

  4. as-cii commented on May 6, 2016

    @as-cii
    Contributor

    Updated in atom/atom@e3790b8.

  5. t9md commented on May 6, 2016

    @t9md
    ContributorAuthor

    Thanks! Not only for this, all your heavy effort to improve Atom at very fundamental layer!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions