Skip to content

Show icon preview in doc snippet #638

Closed

Description

@fabiorogeriosj

image

Activity

  1. DanTup commented on Mar 2, 2018

    @DanTup
    Member

    @devoncarew It'd be really nice to make this work - currently the dartdocs are HTML chunks that won't work here (it's very unlikely we'd ever be able to pull random CSS in to make this work).

    Colours do something similar but they use images:

    screen shot 2018-03-02 at 18 06 10

    Is it likely we could do the same here? I don't know how the colour images were generated and whether we could do the same for these icons (or maybe they're already in a form that can be used directly). WDYT?

  2. added
    is enhancement
    blocked on dart / flutter
    in editor
    on Mar 2, 2018
  3. added this to the Backlog milestone on Mar 2, 2018
  4. added
    upstream in dart / flutter
    and removed
    blocked on dart / flutter
    on Mar 4, 2018
  5. devoncarew commented on Mar 6, 2018

    @devoncarew
    Contributor

    We generate the material icons and the color information from some scripts in the flutter/flutter-intellij repo. If the color info (or some generates icons) and the material design icons would be useful to you, we can generalize those scripts.

  6. DanTup commented on Mar 7, 2018

    @DanTup
    Member

    @devoncarew I was curious how you were handling this in IntelliJ, but I just installed it and I'm not sure it works either.

    Here's help for colours - it includes the image:

    intellij color

    And here's icon:

    intellij icon

    So in IntelliJ for icons you just see the text out of the HTML (but no icon). If the Flutter class dartdocs had image references (like colours) then these would display there.

    The downside, is that the Icons page on the Flutter website would render a lot of images (whereas currently it uses the material icons loaded), but I guess it's already doing that for colours and I think help in the IDE is at least as important as help on the website.

    WDYT? Shall I raise @flutter?

  7. devoncarew commented on Mar 7, 2018

    @devoncarew
    Contributor

    Ah, we don't handle for tooltips, but we do show previews of the colors and material icons in the editor's gutter to the left. If you reference something like Icons.info_outline in your code you'll see an icon on the left.

  8. DanTup commented on Mar 7, 2018

    @DanTup
    Member

    Aha, gotcha :)

    Possibly we could do that in Code if we can get the right info, though I still think we should do something about tooltips (they look bad in both editors, but particularly in Code because the HTML gets rendered verbatim).

    There's an open issue with Code about HTML in hovers not being supported (microsoft/vscode#40607) but I think even when (if) that gets fixed, it'll just become like IntelliJ's with text rendering instead of an icon. It feels a little weird to require custom CSS to render the docs correctly.

    WDYT?

  9. added
    blocked on vs code / lsp / dap
    on Mar 7, 2018
  10. DanTup commented on Mar 29, 2018

    @DanTup
    Member

    I've made this work be regexing the HTML out for an image tag. I'm hot-linking for now to:

    https://storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_$1_white_36px.svg

    It's possible they'll break in future, but I don't think the missing image is any worse than a big chunk of HTML so we'll just update it if it does (though it seems unlikely those files will disappear IMO).

    Currently it'll always show the white icon; it looks poor on the Light theme but I'll fix it up if/when microsoft/vscode#46940 gets addressed.

  11. removed
    blocked on vs code / lsp / dap
    upstream in dart / flutter
    on Mar 29, 2018
  12. modified the milestones: Backlog, v2.12.0 on Mar 29, 2018
  13. added 3 commits that reference this issue on Apr 5, 2018
    8e062b5
    9e68ab5
    7895c1e
  14. added a commit that references this issue on Apr 16, 2018
    3a3410d
  15. ffeu commented on Sep 18, 2018

    @ffeu

    @DanTup
    Hi, I can no longer see the icons preview in VS Code. Is it just me?

  16. DanTup commented on Sep 18, 2018

    @DanTup
    Member

    @ffeu I don't know if it's just you, but it does seem ok here:

    screen shot 2018-09-18 at 19 00 40

    Can you open a new issue include a screenshot, whether there are any errors in the console (Help -> Toggle Dev Tools) and also a log captured while you're viewing the help?

    Thanks!

  17. 3141bishwa commented on Nov 18, 2019

    @3141bishwa

    Hi there. Is there any way to get preview working for Cupertino Icons too? Right now, it seems to work for Material Icons only.

    Material Icon Preview
    material icons

    Cupertino Icon Preview
    cupertino

  18. DanTup commented on Nov 18, 2019

    @DanTup
    Member

    @3141bishwa it looks like the documentation for that class does not include previews, see:

    https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html
    vs
    https://api.flutter.dev/flutter/material/Icons-class.html

    For VS Code, we rely on the documentation and perform a simple regex replace in order to get the icons to work in the tooltips, but there isn't enough info for this in the current ones.

    I opened an issue in the Flutter repo about adding previews there (which we could then use to provide here). I don't know if there's a technical reason it isn't done or not (the Material one uses a font, I'm not sure if that's available in the site for Cupertino):

    flutter/flutter#45097

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editoris enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions