Skip to content

Diagnostic hover doing "word-wrap: break-word;" which makes them hard to read #22239

Closed
@joshbw

Description

@joshbw
  • VSCode Version: 1.10.1 & Insider for Mar 8 2017
  • OS Version: Win 10 RS1

Steps to Reproduce:

  1. Install an extension with fairly long diagnostic hovers (an example included below)
  2. trigger the diagnostic hover
  3. notice that the wrapping of text is breaking words, which makes reading the hover content much more difficult

I'm not entirely certain what to recommend to address this. For the majority of text it is better to just have the word drop down a line rather than be broken, but for long URLs and such breaking a word is preferable. I don't know if you can selectively break words by wrapping them in a span with css "word-wrap: break-word;", but if you can a strategy might be to preprocess the hover text and wrap URLs/UNC paths in said span (I don't know what else other than URLs and paths would be long enough that they need to break-word to fit in the hover box). Alternatively, and this is my preference, you could support links within the hover, so that link text rather than the full URL can be shown. That both makes it easier for people to access the URL (they could just click on it, instead of copying it out of the hover box and pasting in a browser) and provides a mechanism to show shorter text that doesn't need to be broken up

If you want a diagnostic that reproduces this scenario you can grab and install vscode-devskim-0.1.0.vsix from https://github.com/Microsoft/DevSkim-VSCode-Plugin. Once installed, create a new .cpp file and type gets(str); into it - DevSkim will catch the use of gets and add a diagnostic with text long enough that it triggers the undesired wrap conditions

Metadata

Metadata

Assignees

Labels

editor-contribEditor collection of extraslanguages-diagnosticsSource problems reportingunder-discussionIssue is under discussion for relevance, priority, approach

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions