Skip to content

Queries in template literals have leading spaces stripped away on indent #54

@rsslldnphy

Description

@rsslldnphy

Hi, I'm not sure if this is meant to happen but I'm finding that graphql in template literals is having any leading spaces stripped away on indent. I usually indent my graphql template literals by 2 spaces, but with this text:

import gql from 'graphql-tag';

export default gql`
  query OrganisationContext {
    organisation: currentOrganisation {
      id
      name
      slug
    }
  }
`;

the command gg=G results in this:

import gql from 'graphql-tag';

export default gql`
query OrganisationContext {
  organisation: currentOrganisation {
    id
    name
    slug
  }
}
`;

the query has now been shifted to the left so it's flush with the start of the line.

i've removed everything from my ~/.config/nvim/init.vim apart from:

set nocompatible
filetype plugin indent on
syntax on

call plug#begin('~/.config/nvim/vim-plug')
Plug 'jparise/vim-graphql'` 
call plug#end()

set shiftwidth=2
set tabstop=2

is this expected behaviour? examples i've seen in the docs show template literals indented by two spaces - is there a config option i'm missing? thanks!

Vim Version

NVIM v0.4.3
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 -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/config -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/src -I/usr/local/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/deps-build/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/src/nvim/auto -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/include
Compiled by [email protected]

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

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions