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

[bracketed references] in dartdocs are not highlighted as code in tooltips #1763

Open
FrobtheBuilder opened this issue May 29, 2019 · 4 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Milestone

Comments

@FrobtheBuilder
Copy link

FrobtheBuilder commented May 29, 2019

I know that using bracketed names in your dartdoc documentation is a way to refer to symbols, correct? But the popup documentation produced by hovering on a symbol just naively displays them in the same font as the rest of the text, brackets and all. Shouldn't it at least say, format those names with a monospaced font as you typically want with symbols and maybe exclude the brackets or draw them in a lighter color? It's just a bit ugly right now. You can manually format text as code using backticks, but then you can't hover over the names in the dartdoc block to see their own documentation.

I see the formatting I'm looking for in the example cited in #1265 but the editor used there appears to be Android Studio, so this is a feature in that IDE. It would be nice to have it in vscode as well.

Example:
image

@DanTup DanTup added this to the v3.2.0 milestone May 31, 2019
@DanTup DanTup added in editor Relates to code editing or language features is bug labels May 31, 2019
@DanTup DanTup changed the title Apply some formatting to bracketed names in pop-up dartdoc documentation. [bracketed references] in dartdocs are not highlighted as code in tooltips Jun 5, 2019
@DanTup
Copy link
Member

DanTup commented Jun 5, 2019

Unfortunately I had to remove the code that was doing this, because it was also messing up code blocks. For example:

/// [foo]
///
///    var foo = "test";
///    var a = [foo] ;

Here, the first [foo] we'd like to replace with `foo` so it's coloured correctly, but the second we do not (because the sample code would be invalid). To the editor, this is just a string of markdown and we don't do additional parsing to understand which bits are code and which are not (we probably could, but I worry it'd be fragile given how often we find weird cases in code syntax highlighting).

@devoncarew @bwilkerson can you think of any simple solution to this?

@bwilkerson
Copy link

Given the following code

/// [foo]
///
///    var foo = "test";
///    var a = [foo] ;
main() {}
foo() {}

server will create a navigation region for the first foo, but not for the second. (I didn't check for highlighting regions.)

Would it be possible to use the navigation (or highlighting?) regions to differentiate between those two cases?

@DanTup
Copy link
Member

DanTup commented Jun 5, 2019

@bwilkerson interesting idea, though I don't think from the documentation on a hover request we have the necessary info to map it back to a specific source location (we don't have the offset of the docs - which would be in another file - and the docs we get have had the comment markers stripped).

@bwilkerson
Copy link

Oh, right. I hadn't fully understood the conditions. I agree, you don't have enough information at that point.

We've talked before about having server support different formats for the hover information (markdown, html, etc.), and that might solve the problem. Unfortunately, that work hasn't been a high enough priority to get resourced.

@DanTup DanTup modified the milestones: v3.2.0, Backlog Jun 5, 2019
@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label Jun 5, 2019
@DanTup DanTup added in lsp/analysis server Something to be fixed in the Dart analysis server and removed blocked on dart / flutter Requires a change in Dart or Flutter to progress labels Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug
Projects
None yet
Development

No branches or pull requests

3 participants