Closed zenazn closed 2 years ago
A potentially related bug:
import gql from 'graphql-tag';
export default gql`
type Query {
# ('oh no')
foo(id: String): String!
bar(id: String): String
}
`;
If I /foo<CR>o# XXX
(i.e., open a new line after the foo
definition and type # XXX
), I get:
import gql from 'graphql-tag';
export default gql`
type Query {
# ('oh no')
foo(id: String): String!
# XXX
bar(id: String): String
}
`;
If I /bar<CR>o# XXX
(i.e., open a new line after the bar
definition and type # XXX
), I get:
import gql from 'graphql-tag';
export default gql`
type Query {
# ('oh no')
foo(id: String): String!
bar(id: String): String
# XXX
}
`;
The parens with quotes (either single or double work) in the "oh no" comment are important (but the "oh no" is not important). When either is missing, I get the behavior from the original issue
@zenazn I've been looking at this as I've had free time, and I'm unfortunately not able to reproduce either of these issues. I'm using vim 8.2 (1-4600) and the vim's built-in support for TypeScript (i.e. no plugins). Some potentially relevant settings for this buffer:
indentexpr=GetTypescriptGraphQLIndent()
indentkeys=0{,0},0),0],0,,!^F,o,O,e
Could you compare that to what you have and also let me know if you're using a TypeScript language plugin which might be introducing different behavior?
It's also possible there's something more we need to do beyond 51c5b178cce145c3aaa22fbc37fd5d64065baebc to handle an environment like yours.
Please reopen this issue if new information becomes available.
In a typescript file that looks like this:
If my cursor is after the
!
inString!
, and I type<CR>baz: Int!
, I get:I think the correct way to indent this is:
The
!
is important. If I omit the!
I get the expected result.The fact that it's embedded in a typescript file is important. If I put the same contents in a
.graphql
file, I get the expected result.Vim Version
I'm using a neovim at some random commit (
NVIM v0.7.0-dev+nightly-1261-gb4fbb9dcf
), but can repro under a normal version of vim or neovim if this isn't something that trivially reproduces!