jparise / vim-graphql

A Vim plugin that provides GraphQL file detection, syntax highlighting, and indentation.
MIT License
487 stars 25 forks source link

Feature: Add Support for PHP HEREDOC Strings #61

Closed phatsk closed 3 years ago

phatsk commented 4 years ago

PHP has support for HEREDOC strings. This allows large string blocks to be set between delimiters and vim supports syntax highlighting within these blocks.

In PHP in vim, using a HEREDO specifier such as SQL will cause vim to highlight the given block:

<?php
$my_query = <<<SQL
SELECT * FROM my_tables WHERE foo='bar';
SQL;

This proposal is to have the same kind of support for GraphQL queries:

<?php
$my_query = <<<GQL
{
    posts {
        id
        title
        author
    }
    category
}
GQL;

Screenshot

image

Vim Version

NVIM v0.5.0-nightly
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20200316-52073-155cxzr/build/config -I/tmp/neovim-20200316-52073-155cxzr/src -I/usr/local/include -I/tmp/neovim-20200316-52073-155cxzr/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200316-52073-155cxzr/build/src/nvim/auto -I/tmp/neovim-20200316-52073-155cxzr/build/include
Compiled by zachowen@MacBook-Pro

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-2b00d1d/share/nvim"

Run :checkhealth for more info
jparise commented 3 years ago

@phatsk I just added PHP support. Let me know how it works or if you run into any issues with it.

Thanks for the suggestion!