![]() It will format your GraphQL code and output pretty and readable code in the editor below the Formatted GraphQL title. ![]() Upside is that you can use neovim as client to any LSP, be it for C++, Rust, JavaScript, or whatever more obscure languages come with an LSP implementation these days. Enter your GraphQL code or query in the editor below. Now, I haven't tested this, so I'm sure the devil's in the details of setting up neovim + LSP for graphql (I use astronvim to get a useful base configuration, by the way), so I'm afraid I'll leave this level of working things out for you. So, as a command line, something like nvim -c ':set ft=graphql' -c ':lua ()' -c ':w' -c ':q' yourfile Then, you issue the command to open a file, set the file type to GraphQL ( :set ft=graphql), and run :lua (), and save the resulting file ( :w), and quit. You need to set it up such that automatically starts the LSP server as needed, and connects to it, when a graphql file is loaded. In this case, neovim seems to be your best bet. Then, you'd want to use a client that can take a command to format the file. Try installing it via npm: npm i -g graphql-language-service-server. In case of GraphQL, that's the formerly-available-as-standalone-project graphql-language-service. Like, why? Makes everything harder, but great, now you can make more buggy releases in shorter time.Īnyways, what you want is to use the Language Server Protocol (LSP) server for GraphQL, which things like VS Code and the totally necessary GraphiQL IDE use internally to indent code, understand the symbols under the cursor, autocomplete,… So, first of all, if you have any contacts at meta, tell them how bad a design decision it was to merge the well-working graphql utilities all into the GraphiQL IDE monorepo.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |