Giter Club home page Giter Club logo

language-graphql's Introduction

language-graphql Build Status Version

Atom syntax highlighting for GraphQL, ported from language-babel.

image

Todo

  • Autocompletion based on a JSON or pretty-printed schema.

Development

  • Run tests: apm test
  • Open with grammar reloading:
    • Add the project to Atom's packages apm link .
    • Open the project in development mode atom --dev .
    • Create a scratch.graphql file to check highlighting

License

MIT

language-graphql's People

Contributors

decentm avatar jrylan avatar michaelmerrilltest avatar pchaigno avatar rmosolgo avatar tonyxiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

language-graphql's Issues

Highlight type definition language

I think READMEs will often want to describe their schema in GraphQL form, like so:

type Comment {
  postedBy: User!
  createdAt: String! # Actually a date
  content: String!
}

type Entry {
  repository: Repository!
  postedBy: User!
  createdAt: String! # Actually a date
  score: Int!
  comments: [Comment]! # Should this be paginated?
  commentCount: Int!
}

As you can see, comments and arguments are highlighted but not other stuff. It would be cool to highlight for example the type keyword, the types, etc.

Syntax highlighting for new description syntax

Hi, the latest GraphQL spec updated the description syntax: graphql/graphql-js#927. This is not supported by the current syntax highlighting. An example:

"""
Description that is

spanning multiple lines
"""
type Test {
   "Field description"
   field: String
}

The current comment element is here: https://github.com/rmosolgo/language-graphql/blob/master/grammars/graphql.json#L162-L169 but for backwards compatibility, I think two new elements (descriptionline and descriptionblock) might be best?

Support for string literal comments

as of graphql 0.12.3 you can now add comments as string literals

"This is a description."
schema {
    query: Query
}

if we could highlight this somehow, maybe even as comments. note: they can be multi line.

Collaborating nuclide graphql language service

@rmosolgo - Apologies for opening an issue; I wanted to chat with you about us collaborating to develop Nuclide GraphQL language service, but couldn't find a viable contact information. Would you be interested in working together to provide Nuclide/Atom language service?

Let me know what you think!

Publish to npm

Can you publish this to npm as atom-language-graphql so that it can be used with highlights?

Remove CHANGELOG.md or keep it up to date

Thanks for a nice package ๐Ÿ‘

I really love a good CHANGELOG to get to know what's new in a version, but what's worse than no CHANGELOG is an outdated one โ€“ especially for an Atom package as Atom itself highlights the CHANGELOG on the package's page in the app.

As it looks like the CHANGELOG is no longer intended to be updated, then it should in my opinion be removed.

Broken syntax highlighting for @doc within enum

Problem

Highlighting fails inside the enum declaration. Everything wants to be orange.

Screenshot

screen shot 2018-12-10 at 2 47 43 pm

Testing code

type ApprovalRequirements {
    approval_list_required: Boolean @doc(description: "Require approval if items are not in a list.")
    approval_subtotal: Float @doc(description: "Dollar amount. Theshold determined when 'Sometimes require approval' is set.")
    approver_id: ID @doc(description: "Entity ID of the user who approves.")
    requires_approval: RequiresApprovalEnum! @doc(description: "")
}

enum RequiresApprovalEnum @doc(description: "State for when approval is required, which determines approval conditions.") {
    ALWAYS @doc(description: "Always require approval")
    NEVER @doc(description: "Does not require approval")
    SOMETIMES @doc(description: "Sometimes require approval")
}

Unknown directive "connection"

@connection(key: "Posts_allPosts") { invokes error "Unknown directive "connection""

export default createFragmentContainer(
  Posts,
  graphql`
    fragment Posts_viewer on Viewer {
      allPosts(first: $first, orderBy: createdAt_DESC)
        @connection(key: "Posts_allPosts") {
        edges {
          node {
            id
            ...Post_post
          }
        }
      }
      # To understand what's happening here:
      # Post_viewer fragment will be attached to viewer.__fragments for Post.js
      ...Post_viewer
    }
  `,
);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.