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

ppx deriving on a type adversely affects merlin location #1660

Closed
ddickstein opened this issue Aug 11, 2023 · 1 comment · Fixed by #1664 or ocaml/opam-repository#24310
Closed

ppx deriving on a type adversely affects merlin location #1660

ddickstein opened this issue Aug 11, 2023 · 1 comment · Fixed by #1664 or ocaml/opam-repository#24310

Comments

@ddickstein
Copy link
Contributor

Given:

open Core
module M = struct
  type t =
    | Foo
    | Bar
end

Getting the type of t highlights just the type definition and gives type t = Foo | Bar as expected. However, given:

open Core
module M = struct
  type t =
    | Foo
    | Bar
  [@@deriving compare]
end

Getting the type of t selects the entire module and returns it as sig type t = Foo | Bar val compare : t -> t -> int end.

voodoos added a commit that referenced this issue Aug 24, 2023
voodoos added a commit to voodoos/merlin that referenced this issue Aug 24, 2023
voodoos added a commit to voodoos/opam-repository that referenced this issue Aug 24, 2023
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
voodoos added a commit to voodoos/opam-repository that referenced this issue Aug 24, 2023
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
voodoos added a commit to voodoos/opam-repository that referenced this issue Aug 24, 2023
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
voodoos added a commit to voodoos/opam-repository that referenced this issue Aug 24, 2023
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
@voodoos
Copy link
Collaborator

voodoos commented Sep 7, 2023

Retrospectively, I discovered the merlin.hide and merlin.focus attributes which are specifically designed for ppxes. The better fix would be for ppx_compare to make use of merlin.focus to guide Merlin in the correct branch.

Doc: https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md#locations-in-ppx-rewriters

voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 1, 2023
CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 1, 2023
CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 1, 2023
CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
    - Add support for OCaml 5.1.1 (ocaml/merlin#1714)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 1, 2023
CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
    - Add support for OCaml 5.1.1 (ocaml/merlin#1714)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)

[new release] merlin-lib and merlin (4.13-501)

CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)

[new release] merlin-lib and merlin (4.13-414)

CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 18, 2023
CHANGES:

Mon Dec 18 16:42:00 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
voodoos added a commit to voodoos/opam-repository that referenced this issue Dec 18, 2023
CHANGES:

Mon Dec 18 16:42:00 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
nberth pushed a commit to nberth/opam-repository that referenced this issue Jun 18, 2024
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
nberth pushed a commit to nberth/opam-repository that referenced this issue Jun 18, 2024
CHANGES:

Thu Aug 24 17:17:42 CEST 2023

  + merlin binary
    - Constrain socket path buffer size to avoid build warnings (ocaml/merlin#1631)
    - Handle concurrent server start (ocaml/merlin#1622)
    - Omit module prefixes for constructors and record fields in the
      `construct` command (ocaml/merlin#1618).  Prefixes are still produced when
      warning 42 (disambiguated name) is active.
    - Correctly invalidate PPX cache when pipeline ran partially (ocaml/merlin#1650,
      fixes ocaml/merlin#1647)
    - Prevent `short-path` from looping in some cases related to recursive type
      definitions (ocaml/merlin#1645)
    - Support parsing negative numbers in sexps (ocaml/merlin#1655)
    - Fix construct not working with inline records (ocaml/merlin#1658)
    - Improve behavior of `type-enclosing` on let/and operators (ocaml/merlin#1653)
    - Fix occurrences of extension constructors (ocaml/merlin#1662)
    - Improve node selection when ghosts are present (ocaml/merlin#1664, fixes ocaml/merlin#1660)
  + editor modes
    - emacs: call merlin-client-logger with "interrupted" if the
      merlin binary itself is interrupted, not just the parsing of the
      result (ocaml/merlin#1626).
    - emacs: merlin-construct, with a prefix argument, now includes
      local values in the completion options.  Alternatively, this
      behavior can be enabled permanently by customizing
      `merlin-construct-with-local-values` (ocaml/merlin#1644)
    - emacs: add support for opam-switch-mode (ocaml/merlin#1654, fixes ocaml/merlin#1591).
      See <https://github.com/ProofGeneral/opam-switch-mode>
nberth pushed a commit to nberth/opam-repository that referenced this issue Jun 18, 2024
CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
    - Add support for OCaml 5.1.1 (ocaml/merlin#1714)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)

[new release] merlin-lib and merlin (4.13-501)

CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Ignore the new 5.1 `cmi-file` flag instead of rejecting it (ocaml/merlin#1710, fixes
      ocaml/merlin#1703)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)

[new release] merlin-lib and merlin (4.13-414)

CHANGES:

Fri Dec  1 15:00:42 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
nberth pushed a commit to nberth/opam-repository that referenced this issue Jun 18, 2024
CHANGES:

Mon Dec 18 16:42:00 CET 2023

  + merlin binary
    - Fix a follow-up issue to the preference of non-ghost nodes introduced in ocaml/merlin#1660 (ocaml/merlin#1690, fixes ocaml/merlin#1689)
    - Add `-cache-lifespan` flag, that sets cache invalidation period. (ocaml/merlin#1698,
      ocaml/merlin#1705)
    - Fix Merlin locate not fallbacking on the correct file in case of ambiguity
      (@goldfirere, ocaml/merlin#1699)
    - Fix Merlin reporting errors provoked by the recovery itself (ocaml/merlin#1709, fixes
      ocaml/merlin#1704)
  + editor modes
    - vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    - emacs: highlight only first error line by default (ocaml/merlin#1693, fixes ocaml/merlin#1663)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants