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

Allow customizing diagnostics styles #1856

Merged
merged 8 commits into from Oct 28, 2021
Merged

Allow customizing diagnostics styles #1856

merged 8 commits into from Oct 28, 2021

Conversation

iamkroot
Copy link
Contributor

@iamkroot iamkroot commented Sep 19, 2021

This change brings back the "diagnostics_highlight_style" preference to allow customization of diagnostic styles, albeit only for single-lines.

See #1729

I am not sure how to update the sublime-package.json file with the new schema. Specifically, I want to use the $ref feature to not have to repeat the same schema. I have something like this:

"diagnostics_highlight_style": {
  "oneOf": [
    {
      "enum": ["default", "box", "underline", "stippled", "squiggly", ""],
      "default": "default"
    },
    {
      "properties": {}  // way too much repetition here, need to reuse the previous schema
    }
  ],
  "default": "default",
  "markdownDescription": ""  // how to deal with code snippet inside this? (refer to the description in default settings file)
},

@jwortmann
Copy link
Member

jwortmann commented Sep 19, 2021

I would drop the value "default" and explicitly use the mapping to severities as the default setting value. This makes it easier for users to see what the setting is expected to look like, if they want to adjust styles per severity.

In "markdownDescription" you can use Markdown as its name says ;) So fenced code blocks or indented code blocks should both work. I think sometimes the Markdown parser expects double linebreaks for correct formatting. For example:

"markdownDescription": "Highlight style of code diagnostics.\nThis is a fenced code block:\n\n```json\n{\n    \"hello\": \"world\"\n}\n```\n"

There is also a copy/paste error from "document highlights" in the settings description, and the name for Python's "dict" in JSON would be "object" (or you could use a generic word like "mapping" instead).

plugin/core/types.py Show resolved Hide resolved
plugin/core/types.py Outdated Show resolved Hide resolved
plugin/core/types.py Show resolved Hide resolved
@iamkroot iamkroot marked this pull request as ready for review September 21, 2021 04:05
plugin/core/types.py Show resolved Hide resolved
plugin/core/types.py Outdated Show resolved Hide resolved
sublime-package.json Outdated Show resolved Hide resolved
plugin/session_view.py Outdated Show resolved Hide resolved
@rwols rwols merged commit 3dc41e4 into sublimelsp:main Oct 28, 2021
@iamkroot iamkroot deleted the diag-styling branch October 29, 2021 02:11
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.

None yet

3 participants