Skip to content

Conversation

@SATVIKsynopsis
Copy link

Fixes #4763

This PR updates the Notes plugin to safely handle cases where note definitions or references are missing.
So, Instead of throwing internal errors, the plugin now returns Null results as expected by the LSP specs.

Changes include:

  1. Graceful handling of missing notes in jump-to-definition and references.

  2. Replacing unsafe lookups with fromMaybe.

  3. Cleaning up unused imports.

Functionality tested with a simple example; jump-to-definition works correctly and missing notes no longer cause errors.

Copy link
Collaborator

@jvanbruegge jvanbruegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is really hard to tell what the actual changes are here. Please do not do any reformatting in the same commit as you do functional changes. That is even ignoring that the changed formatting does not even pass the pre-commit hook from the project.

Please remove all reformatting from this PR, or at least split it into a separate commit

matchAllText noteRefRegex ln
where
atPos c arr = case arr A.! 0 of
-- We check if the line we are currently at contains a note
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete this comment?

mContents <- liftIO (runAction "notes.getfileContents" state (getFileContents nfp))
case mContents of
Nothing ->

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra newlines?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hls-notes-plugin crashes instead of reporting no locations

2 participants