GoLand has syntax support on Go html files with the file extension of .gohtml
So what about Go text files? Does GoLand support that as well? .tmpl is supported by vim-go but not GoLand.
As mkopriva has already hinted and you have described as well in the comments, you can go to Preferences/Editor/File Types and add your custom ending as Registered pattern to the Go Template. But imo the real game changer is that you can also set Go as Template data language there. This way even the Go syntax gets validated, not just the template syntax. It's still wonky, but definitly better than nothing.
Still, autoformatting does not work properly and can screw up your code. Therefore, you might also want to make sure the Reformat code in the commit dialog is unchecked. Same with Optimize Imports ... better keep it unchecked.
there are two parts to this answer to get both html highlighting and go template highlighting
go template highlighting:
settings > editor > file types > select Go template files from the list > update pattern to the file ending you use for your go templates. I used *.go.html
html highlighting
settings > template data languages > project language (dropdown at the top) > set to html
now you have both html highlighting and go template completion
Related
I am using Go HTML Templates in Jetbrains Goland. How do I get all 3: HTML formatting, template code completion, and template formatting for templates?
Assuming I installed Go Templates plugin and I am using "*.tpl" as a file extension for my templates, I have two options:
Settings - Editor - Filetypes - HTML - Add "*.tpl" as an HTML type.
PROS: I have an HTML code completion and syntax highlighting with a caveat (see CON 2)
CON 1: I do not have code completion on template items, the editor is unaware of templates at all
CON 2: Template code blocks are treated as text, i.e. I do not have code indentation for RANGE blocks for example when I try to format my code.
Settings - Editor - Filetypes - Go Templates - Add "*.tpl" as registered type with "HTML" as an underlying type ("Template data language")
PROS: I have code completion for 'dots' and can see properties and methods on them (see https://www.jetbrains.com/help/go/integration-with-go-templates.html)
CONS: No HTML highlighting, autocompletion, or formatting...
After hours of research, I finally found the answer:
Settings - Languages and Frameworks - Template Data Languages - Project Language - Set "HTML"
Also, I suggest using "*.go.html" as a Go Templates extension. This way you can see syntax highlighting even when opening the template in VSCode, online on GitHub, etc.
I have started using Semantic UI and I noticed that when I want to customize my css, I need to make .variables and .overrides files. Their syntax is just like .less syntax, but they're treated differently by their types.
What I want now, is when I open a .variables or a .overrides files, PhpStorm will treat it as a less code style. Is it possible to achieve it?
If there's an option to do per Project, it'll be perfect.
I'm using CouchCMS which is a brilliant little inline CMS. It requires custom tags for many of the features like <cms:editable></cms:editable>
PhpStorm keeps telling me these are not valid (I think that's what it's trying to say anyway)
They all show up as a red line on the scrollbar and show as errors in the analysis. How can I tell PhpStorm this is okay?
It throws a different error for the <cms:template> tag since it's before the doctype.
Open File > Settings > Editor > Inspections
Expand XML
Uncheck Unbound XML namespace prefix
I'm using Kate as the editor of my Node.js projects. In the Node.js projects, I sometimes prefer to code whole index.html in a single file. At that time, I need to use:
html
css (<style>...</style>)
livescript (<script type="text/ls">...</script>)
javascript (<script [type="text/javascript"]>...</script>)
at the same time. Kate can highlight these codes if they are in their separate files.
How can I make the code highlighted correctly when they are mixed in a single file (preferably in Kate, or any other editor that would run on Linux)?
Kate can do this, too. It is supported in e.g. HTML/PHP highlighting and similar. Just have a look into the respective highlighting xml files to get an idea how to implement a highlighting for this. More information about how to write syntax highlighting files can be found in the KatePart Handbook.
I'm looking for a .properties file for Markdown syntax in SciTE. Is it possible?
A partial highlighter would do, otherwise.
I'm using this syntax file: https://github.com/leafnode/markdown_npp with some color changes to fit dark background.
I've uploaded my (dark) user-defined language Markdown highlighter on GitHub. It uses different workarounds than thomsmits', which for the style of Markdown I've chosen work better.
Until the Markdown Scintilla lexer is imported into Notepad++, user defined languages are the best we can do.
I don't use Notepad++ any more and have deleted my project. Try Brettz9's fork of the project here: https://github.com/brettz9/Notepad---Markdown-Highlighting
I'm using Markdown-plus-plus. The install instruction is outdated on many projects. The actual instruction is:
Select menu "Language" → "Define your language..."
Press button "Import...", and select {markdown}.xml (from GitHub repositories).
Restart Notepad++
I believe somebody mentioned on the mailing list that he is working on such a lexer.
I don't think a simple .properties file can do the job, as there isn't any existing lexer (to my knowledge) with similar syntax.