Skip to content

Indentation in gql` string literals is wrong, unconfigurable #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bryankennedy opened this issue Jun 5, 2019 · 10 comments
Closed

Indentation in gql` string literals is wrong, unconfigurable #258

bryankennedy opened this issue Jun 5, 2019 · 10 comments

Comments

@bryankennedy
Copy link

Version and Environment Details

Operation system: macOS 10.14.5

IDE name and version: InteliJ IDEA Ultimate 2019.1.3

Plugin version: v2.1.0

Expected Behaviour

I should be able to configure the number of spaces used for indentation in .graphql files and in gql string literals. These two indentation setups should be the same.

Actual Behaviour

In my current setup I have my JS files set to indent code at 2 spaces. When these files include gql string literals the indentation within that gql code is 4 spaces. In my fully GraphQL files like thing.graphql the indentation is handled with 2 spaces.

In this issue #180 there is a mention of the GraphQL pane in the Preferences > Code Style. I don't see this pane any longer. Was it removed, or do I have something misconfigured? Forgive me if this is something wrong about my install. I couldn't find any details about how to set this in past issues or the existing documentation.

Steps to Reproduce / Link to Repo with Reproduction and Instructions

Create a .js file, add a gql string literal. If you have your Javascript indent spaces set to 2 spaces, the gql fragment will still get set to 4 spaces.

@EugeneDraitsev
Copy link

I faced with same issue. Seems like it happens after upgrade plugin to 2.1 from 2.0 or idea to 2019.1.3 from EAP

@miro-ku
Copy link

miro-ku commented Jun 12, 2019

Same here. After updating WebStorm to 2019.1.3 have got 4 spaces indentation in string literals with no possibility to configure

@kptlronyttcna
Copy link

kptlronyttcna commented Jun 12, 2019

Same issue for me (using windows).

@jimkyndemeyer
Copy link
Collaborator

The dedicated code style tab was lost in the 1.x to 2.x migration.

For now, the GraphQL indentation is controlled by the following setting:

image

@EugeneDraitsev
Copy link

@jimkyndemeyer

screencast 2019-06-13 11-18-56 gif sb-779b8554-bYSWsX

Seems like this option is not working too.

@jimkyndemeyer
Copy link
Collaborator

@EugeneDraitsev Try with tab size 1:

image

@EugeneDraitsev
Copy link

I tried invalidate cache and restart idea, different values here, but it still works like Tab Size: 4 and Indent: 4
screencast 2019-06-13 12-05-50 gif sb-779b8554-FeU3VC

@jimkyndemeyer
Copy link
Collaborator

Hmm, it appears the the "Other File Types" setting only applies to .graphql files and not injected GraphQL in JavaScript.

I haven't changed anything between 2.0 and 2.1 so not sure what's going on. Could be a change in how the IntelliJ platform formats injected languages.

It's likely that the code style page for GraphQL needs to be reintroduced to fix this.

@jimkyndemeyer
Copy link
Collaborator

Fixed in 2.2.0 pending JetBrains approval: Added Code Style settings page to control indentation

@bryankennedy
Copy link
Author

I can confirm with the updated plugin that this fixes the problem. Thanks for getting it fixed so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants