Skip to content

Conversation

@adalinesimonian
Copy link
Contributor

@adalinesimonian adalinesimonian commented Nov 17, 2021

Context: stylelint/vscode-stylelint#315, stylelint/stylelint#5694

Allows for better diagnostics in linters, language servers, and plugins.

Currently, since only single positions are supported, this means that downstream, when we display errors in different tools, in my particular case, a language server and editor integration, we can only display a single position as part of the error, even when the error pertains to more than just one character.

These changes allow warnings and errors to be emitted with an additional endLine and endColumn which pertains to an end position, exclusive, of the problem. It also adjusts CSS syntax errors to always provide an end position for consistency. With these additions, we would be able to better highlight problems in Stylelint and other tools and use that information in integrations for a better developer experience.

  • End position is exclusive for consistency with Language Server Protocol ranges
  • Tests added for ranges
  • Default warning message text is unchanged and still shows a single position
  • Additional properties added to warnings, warning options, errors, and file positions
  • rangeBy added, which provides a range for a given word or start and end indices
  • Changes to functions made in such a way that they can still be called with their former signatures to avoid breaking existing dependent code

Allows for better diagnostics in linters, language servers, and plugins.
@ai
Copy link
Member

ai commented Nov 17, 2021

Wow. Looks cool and very on time (I am planing 8.3 release next week or next month).

@yoyo837
Copy link

yoyo837 commented Nov 17, 2021

Great work!

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.

3 participants