-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Multiple language / LSP on same file #199520
Comments
MWE (minimal working example/illustration): <?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE html> -->
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=80%, initial-scale=1.0"/>
<title>HTML with XML</title>
</head>
<body>
<p hidden>Attribute value validation</p>
Entity validation: &
</body>
</html>
Modified image showing imagination of what-if-both extensions/LSs could work together |
Have you investigated all the links given by @aeschli in #1751 (comment)? If so, what showstoppers did you encounter? |
hi @gjsjohnmurray - the use case i shared is not dealing with injections in first place. the whole of document is to be acted upon by extensions of both the languages together. that issue deals with injections or embeddings: "ohkay, here it's js, but inside this string, it's html" |
You say you want to set multiple languages for the same file, such as XML and HTML. |
i have added links in description to all the extensions mentioned. this would make it easy to go to them to see all mentioned non-html & few even non-xml examples of languages based on meta-like-languages like xml, js, etc. html ain't alone in this suffering. these quotations shows same quest:
this would also makes it optional for these language extensions to implement their formatters. the default xml formatter (from redhat) is functional and can quench any urgent requirement for a dedicated formatter. |
Currently, a document has one language id assigned to it. We don't want to change that. One language is the main language, defining the overall structure. Still, that's just our approach. The APIs allow composition, so I encourage you to try things out. Write a extension that forwards XML features to the HTML language... Or help us improve the HTML extension... Closing as 'out of scope'. We stick with one language per document. |
@aeschli can u make it closed as not planned ? 2023-12-13 anyhow... i will live with it for the time being. |
I'd like to:
use case:
practical case in hand:
.xhtml
filesredhat.vscode-xml
(currently inxml
language mode)(earlier, also additional semantic constraints using grammar from doctype declarations or DTD's; but that's thing of past now)
vscode.html-language-features
(currently inhtml
language)solutions:
xhtml
, or putting optional xml validation in html one)but better would be: to have multiple different dedicated things beautifully working together :) {unix philosophy} as this would:
i.e. similar to the goal of LSP, this second method would keep the complexity to
m + n
rather thanm * n
where m is features related to XML (or other such meta language), and n is number of languages based on it
redhat.vscode-xml
,rogalmic.vscode-xml-complete
,quodatum.vscode-basex
basex xml based databasetotalcross.android-xml-editor
android layout.xml,openSUSE.daps
docbook,erral.erral-zcmlLanguageConfiguration
zcml zope,vscode.html-language-features
html,jock.svg
svgfelgo.felgo
(qml qt)this request is not to be confused with "embedded languages" or "language injections" (#1751 or https://code.visualstudio.com/api/language-extensions/embedded-languages)
there was a similar request of having multiple formatter to act on same file a while ago in context of python. i can't find that - so, sorry if a duplicate exists for multiple lsps too.
some of the tried searches 🔍 :
The text was updated successfully, but these errors were encountered: