Skip to content

Add Hover, Go to definition, Search by title, and user-defined patterns for triggering completion #9

@utensil

Description

@utensil

These features are the ones I desired for a long time. Today I finally sit down to implement a prototype for them.

The code still needs a bit clean up, but it's working locally. The development branch is https://github.com/utensil/vscode-forester/tree/dev . There is a long holiday coming, so I might not be able to polish it for a PR very soon, but let's log the issue here.

Some screenshots for a preview:

Hover

image

Implemented as a HoverProvider.

Go to definition

image

Implemented as a DefinitionProvider.

There is a caveat that although I got the right range for matching, but when cmd/ctrl+hover, it shows an underline only for the current word range matching /\w+/ not including digits and - etc. that often appear in tree ids. The screenshot shows such issue.

Search by title

Implemented as a WorkspaceSymbolProvider.

One could bind cmd/ctrl+K to it so that it works the same as on forester web page.

image

One caveat is that it's not fuzzy search yet.

user-defined patterns for triggering completion

image

I've defined a lot of macros such as for references and definitions, they would need the same completion as the official macros. The current code hard-coded some of my patterns in it, but it could be some user regex configuration, ideally, one can specify which taxon is the pattern for.

There is a bug I'm still trying to figure out why: \citet{fig. 1}{ can not match (but the same one matches in dev console!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions