Giter VIP home page Giter VIP logo

Comments (26)

TuralAsgar avatar TuralAsgar commented on May 18, 2024 9

Is there any syntax highlighter for Intellij based IDEs?

from quicktemplate.

escholtz avatar escholtz commented on May 18, 2024 8

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.

warbear0129 avatar warbear0129 commented on May 18, 2024 6

@valyala hi i like quicktemplate so much i made a simple syntax highlighter for vim. https://github.com/warbear0129/vim-qtpl

from quicktemplate.

b0o avatar b0o commented on May 18, 2024 6

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.

2018-01-14-20-41-28


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:

Screenshot

from quicktemplate.

atomi avatar atomi commented on May 18, 2024 4

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.

valyala avatar valyala commented on May 18, 2024 3

@escholtz , thanks for the contribution! Just added a link to this issue from the FAQ in the README.md

from quicktemplate.

fatih avatar fatih commented on May 18, 2024 3

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.

codelitt avatar codelitt commented on May 18, 2024 2

@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.

fatih avatar fatih commented on May 18, 2024 1

@codelitt no worries. I apologize if my words were harsh as well. Didn't meant it. Thanks for your understanding.

from quicktemplate.

nezorflame avatar nezorflame commented on May 18, 2024 1

Would love to see someone do the VSCode extension.

from quicktemplate.

m00nyONE avatar m00nyONE commented on May 18, 2024 1

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.

SharanSharathi avatar SharanSharathi commented on May 18, 2024 1

Hello @escholtz, @valyala,
I've added a package in packagecontrol.io for SublimeText - Quick​Template (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.

tobstarr avatar tobstarr commented on May 18, 2024

How about something for vim?

from quicktemplate.

valyala avatar valyala commented on May 18, 2024

@tobstarr , I'm not familiar with vim syntax highlighting, so contributions are welcome :)

from quicktemplate.

valyala avatar valyala commented on May 18, 2024

btw, I use vim, so will be very glad if qtpl syntax highlighting for vim is implemented.

from quicktemplate.

codelitt avatar codelitt commented on May 18, 2024

@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)

warbear0129/vim-qtpl#2

from quicktemplate.

tobstarr avatar tobstarr commented on May 18, 2024

@codelitt that looks pretty cool!

from quicktemplate.

codelitt avatar codelitt commented on May 18, 2024

@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.

valyala avatar valyala commented on May 18, 2024

Re-opened the issue in order to make it more prominent (and it is incomplete yet).

from quicktemplate.

codelitt avatar codelitt commented on May 18, 2024

@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.

codelitt avatar codelitt commented on May 18, 2024

@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.

codelitt avatar codelitt commented on May 18, 2024

@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.

stereosteve avatar stereosteve commented on May 18, 2024

@tural-esger for IntelliJ GoLand I created this issue, which you can upvote: https://youtrack.jetbrains.com/issue/GO-4810

from quicktemplate.

encku avatar encku commented on May 18, 2024

@stereosteve Can we create our syntax highlighting with this
jetbrains create filetype ?

from quicktemplate.

b0o avatar b0o commented on May 18, 2024

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.

frederikhors avatar frederikhors commented on May 18, 2024

Any news for VSCode or Goland?

from quicktemplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.