Skip to content

Commit

Permalink
GraphQL: Add support for Block Strings (stkb#261)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Baker <scsavtnk@gmail.com>
  • Loading branch information
jeremywiebe and stkb committed Mar 25, 2021
1 parent d9d2e17 commit c62907d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ See also [https://github.com/stkb/vscode-rewrap/releases](https://github.com/stk
## Unreleased

- Add ERB (HTML) `.html.erb` (#265).
- Add support for [Block
Strings](https://github.com/graphql/graphql-spec/pull/327)
in GraphQL files. (#261)
- Add XAML type (#263).


Expand Down
6 changes: 5 additions & 1 deletion core/Parsing.Documents.fs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ let mutable languages = [
lang "Git commit" "git-commit" "tag_editmsg"
Markdown.markdown
lang "GraphQL" "" ".graphql|.gql"
configFile
( sourceCode
[ line "#"
block ( @".*?""""""", "\"\"\"" )
]
)
lang "Groovy" "" ".groovy"
java
lang "Handlebars" "" ".handlebars|.hbs"
Expand Down
34 changes: 34 additions & 0 deletions specs/DocTypes/Graphql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
> language: "graphql"
GraphQL supports comments (`#`) and Block Strings (`"""`). Comments are always
single-line, while Block Strings are inherently multi-line. Block Strings are
typically used to provide descriptions (documentation) for GraphQL types and
operations.

## Comments

# a b c d e f g h i -> # a b c d¦
¦ # e f g h¦
¦ # i ¦

## Block Strings

""" ¦ -> """ ¦
a b c d e f g h i a b c d e¦
""" ¦ f g h i ¦
¦ """ ¦

type Mutation { ¦ type Mutation { ¦
""" ¦ """ ¦
This is a long line. -> This is a ¦
""" ¦ long line. ¦
loginUser() String """ ¦
} ¦ loginUser() String
¦ } ¦

foo { ¦ foo { ¦
bar(baz: """ bar(baz: """
a b c d e f -> a b c d e¦
g h ¦ f g h ¦
""") ¦ """) ¦
} ¦ } ¦

0 comments on commit c62907d

Please sign in to comment.