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 support for diagnostics display funcref for more flexible integration #1101

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

martskins
Copy link
Collaborator

This PR provides a config option for a function name to be used as a callback for the publish diagnostics call. What this does is enable us to integrate with external plugins that are used to display diagnostics, such as dense-analysis/ale. The documentation includes an example of how to set that up.

Note that the virtual texts will still be displayed if configured.

Fixes #800 and #852.

@martskins martskins force-pushed the diagnostics-display-funcref branch 3 times, most recently from 190a476 to a18b55c Compare October 9, 2020 17:39
@martskins
Copy link
Collaborator Author

This one is a little more involved or disruptive so I'll leave it to you to decide @autozimu, but I think it's a good way to integrate with ale. I think in our case, given that the server publishes the diagnostics when it pleases, we don't need to answer the ALEWantResults autocmd, so this should be enough.

@martskins martskins force-pushed the diagnostics-display-funcref branch from a18b55c to 2dd003d Compare October 11, 2020 21:43
src/types.rs Outdated
@@ -211,6 +211,7 @@ pub struct State {
pub hide_virtual_texts_on_insert: bool,
pub echo_project_root: bool,
pub enable_extensions: Option<HashMap<String, bool>>,
pub diagnostics_display_funcref: Option<String>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe we should reuse the diagnostics_list config instead? And allow the values to be either Quickfix, Location, Disabled or a Funcref ? I think that makes more sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pushed another commit to remove that config and replace it for support for funcref on LanguageClient_diagnosticsList. Made some changes to how selectionUI works in those terms as well, for the sake of uniformity.

@martskins martskins force-pushed the diagnostics-display-funcref branch from 4ff0ef4 to fe80766 Compare October 22, 2020 16:52
@martskins martskins force-pushed the diagnostics-display-funcref branch from fe80766 to 366e653 Compare October 22, 2020 17:11
@martskins martskins force-pushed the diagnostics-display-funcref branch from 366e653 to 33e94d9 Compare October 22, 2020 17:40
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.

1 participant