helix icon indicating copy to clipboard operation
helix copied to clipboard

Derive Document language name from languages.toml name key

Open the-mikedavis opened this issue 3 years ago • 0 comments
trafficstars

This changes switches from deriving the language name from the languages.toml scope key to name (language_id in the LanguageConfiguration type). For the most part it works to derive the language name from scope by chopping off source. or rsplit_once on . but for some languages we have now like html (text.html.basic), it doesn't. This should be a more accurate fallback for the language_id method which is used in LSP and currently uses the rsplit_once strategy.

Here we expose the language's name as language_name on Document and replace ad-hoc calculations of the language name with the new method.

This is most impactful for the file-type statusline element which is currently using language_id.

It should also improve highlighting in popups for languages like html, erb, ejs, maybe solidity. For most languages there should be no functional changes from this PR.

Supersedes https://github.com/helix-editor/helix/pull/2998 Should make https://github.com/helix-editor/helix/pull/3273 more accurate

the-mikedavis avatar Aug 05 '22 15:08 the-mikedavis