Comments (26)
Is there any syntax highlighter for Intellij based IDEs?
from quicktemplate.
Here is a syntax file I came up with for ST3. Requires GoSublime.
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: "QuickTemplate"
file_extensions:
- qtpl
scope: source.qtpl
contexts:
main:
- include: scope:text.html.basic
- match: "{%"
push: "Packages/GoSublime/syntax/GoSublime-Go.tmLanguage"
with_prototype:
- match: "(?=%})"
pop: true
- match: "(code|space|elseif|endif|endfor|endfunc|comment|endcomment|plain|endplain|stripspace|endstripspace|collapsespace|endcollapsespace|endswitch)"
scope: "keyword.other.go"
I'm a Sublime syntax newbie so probably lots of improvements to be made but the basics seem to work (highlighting html, go, and quicktemplate keywords all in the same file).
from quicktemplate.
@valyala hi i like quicktemplate so much i made a simple syntax highlighter for vim. https://github.com/warbear0129/vim-qtpl
from quicktemplate.
I've begun working on my own Vim Quicktemplate syntax plugin: b0o/quicktemplate.vim.
I'm a complete noob when it comes to creating syntax rules for Vim, and the Quicktemplate grammar is rather complex when you take into account the fact that it essentially has 2+ other languages embedded within it (go, html, [js, css]).
It took me quite a while to get anything working at all, but I think at this point my version offers a bit more room for improvement than warbear0129/vim-qtpl. My main issue with vim-qtpl
was that it's a 'dumb' syntax highlighting plugin - it doesn't attempt to utilize the existing syntax definitions for Go and HTML, so there's only so much it can do.
I would welcome contributions from anyone who is better with VimL or Vim syntax parsing than me, but I'll be attempting to make this plugin semi-complete over the next few weeks.
Update 02-11-2018:
I've been working on this plugin quite a bit, and it's now to the point where most things work quite well. Here's an updated screenshot:
from quicktemplate.
I missed this thread when I opened an issue earlier, but here is basic syntax highlighting for vs code:
https://marketplace.visualstudio.com/items?itemName=vsatomi.vscode-quicktemplate
from quicktemplate.
@escholtz , thanks for the contribution! Just added a link to this issue from the FAQ in the README.md
from quicktemplate.
Unfortunately though, it was not accepted into the main vim-go repo as a PR as the maintainer doesn't want to bother with it.
I've suggested to you that you can provide it as a separate plugin. You didn't and then say you forked vim-go (which I think is unreliable as well, but that's not my business)
I have limited time,a family, work to do, and many other things. I can't just merge every single feature out there in the universe. it's 5-10 lines. Just create a vim-quicktemplate
plugin and there you go. Anyone who uses vim-go can use that as well. It's not hard to create such a plugin. Hope you understand this.
from quicktemplate.
@valyala Actually a quick update. The other vim-qtpl package was pretty bare on features and html syntax support. I found it better to take the well written and supported vim-go plugin and add support quicktemplate syntax. I've been testing it out and this is a much better approach.
The PR I submitted to vim-go is here: fatih/vim-go#1241
My fork here (until @fatih) merges it in: https://github.com/codelitt/vim-go
Hopefully this is much more helpful.
from quicktemplate.
@codelitt no worries. I apologize if my words were harsh as well. Didn't meant it. Thanks for your understanding.
from quicktemplate.
Would love to see someone do the VSCode extension.
from quicktemplate.
Any news for VSCode or Goland?
Yes. take a look inside the README.md file
Is there a syntax highlighting for qtpl files?
Yes - see this issue for details. If you are using JetBrains products (syntax highlighting and autocomplete):
cd JetBrains settings directory
mkdir -p filetypes && cd filetypes
curl https://raw.githubusercontent.com/valyala/quicktemplate/master/QuickTemplate.xml >> QuickTemplate.xml
Restart your IDE
But i have to say it is not very good and no it does not have the type of autocompletion you may expect. its ... lets say .... simple
from quicktemplate.
Hello @escholtz, @valyala,
I've added a package in packagecontrol.io for SublimeText - QuickTemplate (Go)
It supports syntax highlighting, code completion, and a build system to run qtc with a keyboard shortcut.
please give it a try, and share your feedback.
we can add about this package in README.md - https://github.com/valyala/quicktemplate#faq
from quicktemplate.
How about something for vim?
from quicktemplate.
@tobstarr , I'm not familiar with vim syntax highlighting, so contributions are welcome :)
from quicktemplate.
btw, I use vim, so will be very glad if qtpl
syntax highlighting for vim is implemented.
from quicktemplate.
@valyala, @warbear0129's package wasn't working for me and a couple other people. I've submitted a PR that should get it working for most vim runtimes. Also now it works with Vundle and Pathogen.
Thanks to warbear for the syntax file. It just needed some tweaks. If anyone is having issues they can take a look at my fork (if the PR below is not merged)
from quicktemplate.
@codelitt that looks pretty cool!
from quicktemplate.
@tobstarr Thanks! I've been testing it out and it's working very well. Plus it brings all of the awesome things from vim-go to these filetypes (like go fmt)
from quicktemplate.
Re-opened the issue in order to make it more prominent (and it is incomplete yet).
from quicktemplate.
@valyala My fork of vim-go provides this very completely: https://github.com/codelitt/vim-go
Unfortunately though, it was not accepted into the main vim-go repo as a PR as the maintainer doesn't want to bother with it feel like it's a good fit for vim-go
and needs to be a separate plugin. I'm not sure if anyone has any other ideas.
from quicktemplate.
@fatih Perhaps that was poorly worded. I meant unfortunate in the sense of "Now we'll have to sort out something else" and not as a criticism of you. I agree it's a poor choice to try to maintain a separate fork, it's just what I've been doing until I have more time. I completely understand your position as a maintainer and understand you don't feel like this is a good fit for vim-go
. Apologies if my original comment made that seem otherwise.
I just went back and re-read the comments on the PR. I'm not sure what it takes to make a plugin that integrates with another plugin like vim-go
as I'm not overly familiar with vim plugins, but I'll take a look over the next week or so.
from quicktemplate.
@fatih No worries on my end either. I'd welcome any docs about creating a plugin which integrates with/relies on another plugin (in this case vim-go
)
from quicktemplate.
@tural-esger for IntelliJ GoLand I created this issue, which you can upvote: https://youtrack.jetbrains.com/issue/GO-4810
from quicktemplate.
@stereosteve Can we create our syntax highlighting with this
jetbrains create filetype ?
from quicktemplate.
Better vim support would be great. The warbear0129/vim-qtpl plugin sorta works, but breaks as soon as I edit the file. It also doesn't have embedded HTML support which is a big letdown.
from quicktemplate.
Any news for VSCode or Goland?
from quicktemplate.
Related Issues (20)
- New Feature Request - optimized right/left padding %s option
- Uint32 and Uint64 support? HOT 3
- Function type which is called once at compile time HOT 1
- don't work {% case []string %} inside {% switch r.(type) %} HOT 3
- Is quicktemplate safe to render external template from the user?
- Discussion about IDE integration HOT 4
- Use custom Localizer/Formatter
- Allow Call Render Function in Objects
- Why Quicktemplate is NOT the faster? HOT 1
- [Question] leading new line HOT 2
- Multiple languages in templates
- HTML Encoding happens even when equal signs are being used to turn off encoding HOT 1
- Go language server ignores the compiled templates
- hot reload template
- Security: templates are vulnerable to XSS
- Can quicktemplate be used for replacing text/template? HOT 1
- Should a template define at least one function?
- qtc binary is not installed by the command suggested by README HOT 1
- Compile to wasm when template changes
- fasthttp inadvertently pulled in as a dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quicktemplate.