Skip to content

Add config to set syntax for dynamic text document content - #2962

Merged
jwortmann merged 2 commits into
sublimelsp:mainfrom
jwortmann:config-custom-scheme-syntax
Jun 18, 2026
Merged

jwortmann merged 2 commits into
sublimelsp:mainfrom
jwortmann:config-custom-scheme-syntax

Conversation

@jwortmann

Copy link
Copy Markdown
Member

This allows to declare the syntax for buffers with custom URI schemes that are used by the workspace/textDocumentContent request.

Not sure if "syntax_map" is the most descriptive name, but it's somewhat consistent with the existing "markdown_language_map" and I couldn't think of any better name.

Confirmed to work with the JETLS server, which uses custom URI schemes when running certain code actions.

@netlify

netlify Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

βœ… Deploy Preview for sublime-lsp ready!

Name Link
πŸ”¨ Latest commit 9829700
πŸ” Latest deploy log https://app.netlify.com/projects/sublime-lsp/deploys/6a330067b2267a0008dc58a5
😎 Deploy Preview https://deploy-preview-2962--sublime-lsp.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +330 to +331
"jetls-macro-expansion": "Julia.sublime-syntax",
"jetls-type-annotation": "Julia.sublime-syntax"

@rchl rchl Jun 17, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found few places that use window.new_files() and those pass syntax name in a format Packages/PackageName/SyntaxName.sublime.syntax.

Also we could support passing base scope here which would be a bit more future proof.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there’s something like sublime.syntax_for_scope I believe.

@jwortmann jwortmann Jun 17, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found few places that use window.new_files() and those pass syntax name in a format Packages/PackageName/SyntaxName.sublime.syntax.

This is just an example, and users can use the full path if they prefer. I prefer the simple form here because that is less text to read and smaller chance to introduce typos in case someone wants to type that manually.

Also we could support passing base scope here which would be a bit more future proof.

I've thought about this, and I think specifying the syntax directly could be more flexible, because a helper package might want to contribute a custom syntax for certain URI schemes. Similar to what LSP-pyright does for the Markdown fenced code blocks. Technically you could also use a different syntax scope in that case, so specifying syntax or scope should be kind of indifferent, but IMO syntax is more explicit and that is what Window.new_file also takes as the argument. Actually you can even put "jetls-macro-expansion": "scope:source.julia" into this mapping, but in that case the syntax label in the bottom-right corner is bugged: sublimehq/sublime_text#4449

In which way do you think scope would be more future proof?

@rchl rchl Jun 18, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an example, and users can use the full path if they prefer. I prefer the simple form here because that is less text to read and smaller chance to introduce typos in case someone wants to type that manually.

I just thought that using just the file name is invalid and won't work. If it works then it's fine as is.

In which way do you think scope would be more future proof?

Was thinking that it would be resilient to syntax path changing if it refers to some third party syntax that maybe later becomes included in ST or changes owner. But maybe that's a rare case.

@jwortmann
jwortmann merged commit 1e839cd into sublimelsp:main Jun 18, 2026
9 checks passed
@jwortmann
jwortmann deleted the config-custom-scheme-syntax branch June 18, 2026 21:37
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