Skip to content

Latest commit

 

History

History
993 lines (559 loc) · 57.7 KB

File metadata and controls

993 lines (559 loc) · 57.7 KB

graphql-language-service-server

2.13.0

Minor Changes

  • #3521 aa6dbbb4 Thanks @acao! - Fix many schema and fragment lifecycle issues, not all of them, but many related to cacheing. Note: this makes cacheSchemaForLookup enabled by default again for schema first contexts.

    This fixes multiple cacheing bugs, upon addomg some in-depth integration test coverage for the LSP server. It also solves several bugs regarding loading config types, and properly restarts the server and invalidates schema when there are config changes.

    Bugfix Summary

    • configurable polling updates for network and other code first schema configuration, set to a 30s interval by default. powered by schemaCacheTTL which can be configured in the IDE settings (vscode, nvim) or in the graphql config file. (1)
    • jump to definition in embedded files offset bug, for both fragments and code files with SDL strings
    • cache invalidation for fragments (fragment lookup/autcoomplete data is more accurate, but incomplete/invalid fragments still do not autocomplete or validate, and remember fragment options always filter/validate by the on type!)
    • schema cache invalidation for schema files - schema updates as you change the SDL files, and the generated file for code first by the schemaCacheTTL setting
    • schema definition lookups & autocomplete crossing over into the wrong project

    Notes

    1. If possible, configuring for your locally running framework or a schema registry client to handle schema updates and output to a schema.graphql or introspection.json will always provide a better experience. many graphql frameworks have this built in! Otherwise, we must use this new lazy polling approach if you provide a url schema (this includes both introspection URLs and remote file URLs, and the combination of these).

    Known Bugs Fixed

    • #3318
    • #2357
    • #3469
    • #2422
    • #2820
    • many more!

    Test Improvements

    • new, high level integration spec suite for the LSP with a matching test utility
    • more unit test coverage
    • total increased test coverage of about 25% in the LSP server codebase.
    • many "happy paths" covered for both schema and code first contexts
    • many bugs revealed (and their source)

    What's next?

    Another stage of the rewrite is already almost ready. This will fix even more bugs and improve memory usage, eliminate redundant parsing and ensure that graphql config's loaders do all of the parsing and heavy lifting, thus honoring all the configs as well. It also significantly reduces the code complexity.

    There is also a plan to match Relay LSP's lookup config for either IDE (vscode, nvm, etc) settings as they provide, or by loading modules into your graphql-config!

  • #3521 aa6dbbb4 Thanks @acao! - Introduce locateCommand based on Relay LSP pathToLocateCommand:

    Now with <graphql config>.extensions.languageService.locateCommand, you can specify either the existing signature for relay, with the same callback parameters and return signature (of a string delimited by : characters), or you can return an object with {uri, range} for the exact set of coordinates for the destination range. the function can be sync or async.

    Relay LSP currently supports Type and Type.field for the 2nd argument. Ours also returns Type.field(argument) as a point of reference. It works with object types, input types, fragments, executable definitions and their fields, and should work for directive definitions as well.

    In the case of unnamed types such as fragment spreads, they return the name of the implemented type currently, but I'm curious what users prefer here. I assumed that some people may want to not be limited to only using this for SDL type definition lookups. Also look soon to see locateCommand support added for symbols, outline, and coming references and implementations.

    The module at the path you specify in relay LSP for pathToLocateCommand should work as such.

    // import it
    import { locateCommand } from './graphql/tooling/lsp/locate.js';
    export default {
      languageService: {
        locateCommand,
      },
    
      projects: {
        a: {
          schema: 'https://localhost:8000/graphql',
          documents: './a/**/*.{ts,tsx,jsx,js,graphql}',
        },
        b: {
          schema: './schema/ascode.ts',
          documents: './b/**/*.{ts,tsx,jsx,js,graphql}',
        },
      },
    };
    // or define it inline
    
    import { type LocateCommand } from 'graphql-language-service-server';
    
    // relay LSP style
    const locateCommand = (projectName: string, typePath: string) => {
      const { path, startLine, endLine } = ourLookupUtility(
        projectName,
        typePath,
      );
      return `${path}:${startLine}:${endLine}`;
    };
    
    // an example with our alternative return signature
    const locateCommand: LocateCommand = (projectName, typePath, info) => {
      // pass more info, such as GraphQLType with the ast node. info.project is also available if you need it
      const { path, range } = ourLookupUtility(
        projectName,
        typePath,
        info.type.node,
      );
      return { uri: path, range }; // range.start.line/range.end.line
    };
    
    export default {
      languageService: {
        locateCommand,
      },
      schema: 'https://localhost:8000/graphql',
      documents: './**/*.{ts,tsx,jsx,js,graphql}',
    };

    Passing a string as a module path to resolve is coming in a follow-up release. Then it can be used with .yml, .toml, .json, package.json#graphql, etc

    For now this was a quick baseline for a feature asked for in multiple channels!

    Let us know how this works, and about any other interoperability improvements between our graphql LSP and other language servers (relay, intellij, etc) used by you and colleauges in your engineering organisations. We are trying our best to keep up with the awesome innovations they have 👀!

Patch Changes

  • #3521 aa6dbbb4 Thanks @acao! - Fixes several issues with Type System (SDL) completion across the ecosystem:

    • restores completion for object and input type fields when the document context is not detectable or parseable
    • correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions
    • .graphqls ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown
  • Updated dependencies [aa6dbbb4]:

    • graphql-language-service@5.2.1

2.12.0

Minor Changes

Patch Changes

  • #3514 36c7f25c Thanks @acao! - fix svelte parsing, re-load config only on config changes

    • fix esbuild bundling of typescript for svelte2tsx!
    • confirm with manual testing of the vsix extension bundle ✅
    • ensure that the server only attemps to parse opened/saved files when the server is activated or the file is a config file

2.11.10

Patch Changes

  • #3503 6c7adf85 Thanks @acao! - Temporarily revert svelte parsing until we can fix bundling issues with svelte2tsx. For now we return to using the vue parser to parse svelte files which will invariably cause some issues, such as being off by several characters

2.11.9

Patch Changes

2.11.8

Patch Changes

2.11.7

Patch Changes

  • #3488 d5028be2 Thanks @acao! - Bump graphql & graphql-tools version to fix potential runtime security bugs

  • 22771f35 Thanks @acao! - Fixes to svelte parsing, tag parsing refactor

2.11.6

Patch Changes

2.11.5

Patch Changes

2.11.4

Patch Changes

2.11.3

Patch Changes

  • #3322 6939bac4 Thanks @acao! - Bypass babel typescript parsing errors to continue extracting graphql strings

2.11.2

Patch Changes

2.11.2-alpha.0

Patch Changes

2.11.1

Patch Changes

  • #3143 4c3a08b1 Thanks @B2o5T! - [ESLint] enable sonar/prefer-promise-shorthand and sonar/no-dead-store rules

2.11.0

Minor Changes

  • #3148 06007498 Thanks @mskelton! - Use native LSP logger instead of manual file based logging. This fixes errors in Neovim when using the GraphQL LSP.

Patch Changes

2.10.0

Minor Changes

2.9.10

Patch Changes

  • #3150 4d33b221 Thanks @AaronMoat! - fix(graphql-language-service-server): allow getDefinition to work for unions

    Fixes the issue where a schema like the one below won't allow you to click through to X.

    union X = A | B
    type A {
      x: String
    }
    type B {
      x: String
    }
    type Query {
      a: X
    }
  • Updated dependencies [4d33b221]:

    • graphql-language-service@5.1.5

2.9.9

Patch Changes

2.9.8

Patch Changes

2.9.7

Patch Changes

2.9.6

Patch Changes

2.9.5

Patch Changes

2.9.4

Patch Changes

  • #2901 eff4fd6b Thanks @acao! - Reload the language service when a legacy format .graphqlconfig file has changed

2.9.3

Patch Changes

  • #2900 8989ffce Thanks @acao! - use decorators-legacy @babel/parser plugin so that all styles of decorator usage are supported

2.9.2

Patch Changes

  • #2488 967006a6 Thanks @acao! - DisablefillLeafsOnComplete by default

    Users found this generally annoying by default, especially when there are required arguments

    Without automatically prompting autocompletion of required arguments as well as lead expansion, it makes the extension harder to use

    You can now supply this in your graphql config:

    config.extensions.languageService.fillLeafsOnComplete

    Setting it to to true will enable this feature. Will soon add the ability to manually enable this in monaco-graphql as well.

    For both, this kind of behavior would be better as a keyboard command, context menu item &/or codelens prompt

2.9.1

Patch Changes

  • #2829 c835ca87 Thanks @acao! - major bugfixes with onDidChange and onDidChangeWatchedFiles events
  • #2829 c835ca87 Thanks @acao! - svelte language support, using the vue sfc parser introduced for vue support

2.9.0

Minor Changes

  • #2827 b422003c Thanks @acao! - Introducing vue.js support for intellisense! Thanks @AumyF

2.8.9

Patch Changes

  • #2818 929152f8 Thanks @acao! - Workspaces support introduced a regression for no-config scenario. Reverting to fix bugs with no graphql config crashing the server.

2.8.8

Patch Changes

  • #2812 cf2e3061 Thanks @acao! - fix a bundling bug for vscode, rolling back graphql-config upgrade

2.8.7

Patch Changes

  • #2810 f688422e Thanks @acao! - fix graphql exec extension, upgrade graphql-config, fix issue with graphql-config cosmiconfig typescript config loader.

2.8.6

Patch Changes

2.8.5

Patch Changes

  • #2616 b0d7f06c Thanks @acao! - support vscode multi-root workspaces! creates an LSP server instance for each workspace.

    WARNING: large-scale vscode workspaces usage, and this in tandem with graphql.config.* multi-project configs could lead to excessive system resource usage. Optimizations coming soon.

2.8.4

Patch Changes

  • Updated dependencies [d6ff4d7a]:
    • graphql-language-service@5.1.0

2.8.3

Patch Changes

  • #2664 721425b3 Thanks @acao! - This reverts the bugfix for .graphqlrc.ts users, which broke the extension for schema url users

2.8.2

Patch Changes

  • #2660 34d31fbc Thanks @acao! - bump ts-node to 10.x, so that TypeScript based configs (i.e. .graphqlrc.ts) will continue to work. It also bumps to the latest patch releases of graphql-config fixed several issues with TypeScript loading (v4.3.2, v4.3.3). We tested manually, but please open a bug if you encounter any with schema-as-url configs & schema introspection.

2.8.1

Patch Changes

  • #2623 12cf4db0 Thanks @acao! - In #2624, fix introspection schema fetching regression in lsp server, and fix for users writing new .gql/.graphql files

2.8.0

Minor Changes

  • #2557 3304606d Thanks @acao! - upgrades the vscode-languageserver and vscode-jsonrpc reference implementations for the lsp server to the latest. also upgrades vscode-languageclient in vscode-graphql to the latest 8.0.1. seems to work fine for IPC in vscode-graphql at least!

    hopefully this solves #2230 once and for all!

2.7.29

Patch Changes

  • #2553 edc1c964 Thanks @acao! - Fix error with LSP crash for CLI users #2230. vscode-graphql not impacted - rather, nvim.coc, maybe other clients who use CLI directly). recreation of #2546 by [@xuanduc987](https://github.com/xuanduc987, thank you!)

2.7.28

Patch Changes

  • #2519 de5d5a07 Thanks @acao! - enable graphql-config legacy mode by default in the LSP server
  • #2509 737d4184 Thanks @Chnapy! - Add gql(``), graphql(``) call expressions support for highlighting & language

2.7.27

Patch Changes

  • #2506 cccefa70 Thanks @acao! - Remove redundant check, trigger LSP release

  • Updated dependencies [cccefa70]:

    • graphql-language-service@5.0.6

2.7.26

Patch Changes

  • #2486 c9c51b8a Thanks @stonexer! - definition support for operation fields ✨

    you can now jump to the applicable object type definition for query/mutation/subscription fields!

  • Updated dependencies [c9c51b8a]:

    • graphql-language-service@5.0.5

2.7.25

Patch Changes

2.7.24

Patch Changes

  • #2470 d0017a93 Thanks @acao! - Aims to resolve #2421

    • graphql config errors only log to output channel, no longer crash the LSP
    • more performant LSP request no-ops for failing/missing config

    this used to fail silently in the output channel, but vscode introduced a new retry and notification for this

    would like to provide more helpful graphql config DX in the future but this should be better for now

2.7.23

Patch Changes

2.7.22

Patch Changes

  • #2385 6db28447 Thanks @acao! - Stop reporting unnecessary EOF errors when authoring new queries
  • #2382 1bea864d Thanks @acao! - allow disabling query/SDL validation with graphql-config setting { extensions: { languageService: { enableValidation: false } } }.

    Currently, users receive duplicate validation messages when using our LSP alongside existing validation tools like graphql-eslint, and this allows them to disable the LSP feature in that case.

2.7.21

Patch Changes

  • #2378 d22f6111 Thanks @acao! - Trap all graphql parsing exceptions from (relatively) newly added logic. This should clear up bugs that have been plaguing users for two years now, sorry!

  • Updated dependencies [d22f6111]:

    • graphql-language-service@5.0.4

2.7.20

Patch Changes

  • Updated dependencies [45cbc759]:
    • graphql-language-service@5.0.3

2.7.19

Patch Changes

  • c36504a8 Thanks @acao! - - upgrade graphql-config to latest in server
    • remove graphql-config dependency from vscode-graphql and graphql-language-service
    • fix vscode-graphql esbuild bundling bug in vscode-graphql #2269 by fixing esbuild version
  • Updated dependencies [c36504a8]:
    • graphql-language-service@5.0.2

2.7.18

Patch Changes

  • #2271 e15d1dae Thanks @acao! - a few bugfixes related to config handling impacting vim and potentially other LSP server users

2.7.17

Patch Changes

2.7.16

Patch Changes

  • Updated dependencies [2502a364]:
    • graphql-language-service@5.0.0

2.7.15

Patch Changes

2.7.14

Patch Changes

  • #2161 484c0523 Thanks @orta! - Do not log errors when a JS/TS file has no embedded graphql tags

2.7.13

Patch Changes

  • #2111 08ff6dce Thanks @acao! - Support template literals and tagged template literals with replacement expressions

  • Updated dependencies []:

    • graphql-language-service@4.1.4

2.7.12

Patch Changes

  • Updated dependencies [a44772d6]:
    • graphql-language-service@4.1.3

2.7.11

Patch Changes

  • Updated dependencies [e20760fb]:
    • graphql-language-service@4.1.2

2.7.10

Patch Changes

  • #2091 ff9cebe5 Thanks @acao! - Fix graphql 15 related issues. Should now build & test interchangeably.

  • Updated dependencies [ff9cebe5]:

    • graphql-language-service-utils@2.7.1
    • graphql-language-service@4.1.1

2.7.9

Patch Changes

  • Updated dependencies [0f1f90ce]:
    • graphql-language-service@4.1.0

2.7.8

Patch Changes

  • Updated dependencies [9df315b4]:
    • graphql-language-service-utils@2.7.0
    • graphql-language-service@4.0.0

2.7.7

Patch Changes

  • c4236190 #2072 Thanks @acao! - this fixes the parsing of file URIs by graphql-language-service-server in cases such as:

    • windows without WSL
    • special characters in filenames
    • likely other cases

    previously we were using the old approach of URL(uri).pathname which was not working! now using the standard vscode-uri approach of URI.parse(uri).fsName.

    this should fix issues with object and fragment type completion as well I think

    also for #2066 made it so that graphql config is not loaded into the file cache unnecessarily, and that it's only loaded on editor save events rather than on file changed events

    fixes #1644 and #2066

  • df57cd25 #2065 Thanks @acao! - Add an opt-in feature to generate markdown in hover elements, starting with highlighting type information. Enabled for the language server and also the language service and thus monaco-graphql as well.

  • Updated dependencies [df57cd25]:

    • graphql-language-service@3.2.5

2.7.6

Patch Changes

2.7.5

Patch Changes

  • f82bd7a9 #2055 Thanks @acao! - this fixes the URI scheme related bugs and make sure schema as sdl config works again.

    fileURLToPath had been introduced by a contributor and I didn't test properly, it broke sdl file loading!

    definitions, autocomplete, diagnostics, etc should work again also hides the more verbose logging output for now

  • Updated dependencies []:

    • graphql-language-service@3.2.4
    • graphql-language-service-utils@2.6.3

2.7.4

Patch Changes

  • bdd57312 #2047 Thanks @willstott101! - Source code included in all packages to fix source maps. codemirror-graphql includes esm build in package.

  • Updated dependencies [bdd57312]:

    • graphql-language-service@3.2.3
    • graphql-language-service-utils@2.6.2

2.7.3

Patch Changes

  • 858907d2 #2045 Thanks @acao! - fix graphql-js peer dependencies - #2044

  • Updated dependencies [858907d2]:

    • graphql-language-service@3.2.2
    • graphql-language-service-utils@2.6.1

2.7.2

Patch Changes

  • 7e98c6ff Thanks @acao! - upgrade graphql-language-service-server to use graphql-config 4.1.0! adds support for .ts and .toml config files in the language server, amongst many other improvements!

2.7.1

Patch Changes

2.7.0

Minor Changes

  • 716cf786 #2010 Thanks @acao! - upgrade to graphql@16.0.0-experimental-stream-defer.5. thanks @saihaj!

Patch Changes

  • Updated dependencies [716cf786]:
    • graphql-language-service@3.2.0

2.6.5

Patch Changes

2.6.4

Patch Changes

  • 2fd5bf72 #1941 Thanks @arcanis! - Adds support for #graphql and /* GraphQL */ in the language server

  • Updated dependencies [2fd5bf72]:

    • graphql-language-service@3.1.5

2.6.3

Patch Changes

  • 6869ce77 #1816 Thanks @acao! - improve peer resolutions for graphql 14 & 15. 14.5.0 minimum is for built-in typescript types, and another method only available in 14.4.0

2.6.2 (2021-01-07)

Note: Version bump only for package graphql-language-service-server

2.6.1 (2021-01-07)

Note: Version bump only for package graphql-language-service-server

2.6.0 (2021-01-07)

Features

2.5.9 (2021-01-03)

Note: Version bump only for package graphql-language-service-server

2.5.8 (2020-12-28)

Note: Version bump only for package graphql-language-service-server

2.5.7 (2020-12-08)

Note: Version bump only for package graphql-language-service-server

2.5.6 (2020-11-28)

Bug Fixes

  • crash on receiving an LSP message in "stream" mode (1238075), closes #1708
  • languageserver filepath on Windows (#1715) (d2feff9)

2.5.5 (2020-10-20)

Note: Version bump only for package graphql-language-service-server

2.5.4 (2020-09-23)

Bug Fixes

2.5.3 (2020-09-23)

Note: Version bump only for package graphql-language-service-server

2.5.2 (2020-09-20)

Bug Fixes

2.5.1 (2020-09-20)

Bug Fixes

  • better error handling when the config isn't present (#1667) (f414300)

2.5.0 (2020-09-18)

Note: Version bump only for package graphql-language-service-server

2.5.0-alpha.5 (2020-09-11)

Note: Version bump only for package graphql-language-service-server

2.5.0-alpha.4 (2020-08-26)

Features

  • custom config baseDir, embedded fragment def offsets (#1651) (e8dc958)

2.5.0-alpha.3 (2020-08-22)

Note: Version bump only for package graphql-language-service-server

2.5.0-alpha.2 (2020-08-12)

Note: Version bump only for package graphql-language-service-server

2.5.0-alpha.1 (2020-08-12)

Bug Fixes

  • recursively write tmp directories, write schema async (#1641) (cd0061e)

2.5.0-alpha.0 (2020-08-10)

Bug Fixes

  • pre-caching schema bugs, new server config options (#1636) (d989456)

Features

2.4.1 (2020-08-06)

Note: Version bump only for package graphql-language-service-server

2.4.0 (2020-06-11)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.12 (2020-06-04)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.11 (2020-06-04)

Bug Fixes

  • cleanup cache entry from lerna publish (4a26218)

2.4.0-alpha.10 (2020-05-28)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.9 (2020-05-19)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.8 (2020-05-17)

Bug Fixes

  • remove problematic file resolution module from webpack sco… (#1489) (8dab038)
  • repair CLI, handle all schema and LSP errors (#1482) (992f384)

Features

2.4.0-alpha.7 (2020-04-10)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.6 (2020-04-10)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.5 (2020-04-06)

Features

2.4.0-alpha.4 (2020-04-03)

Bug Fixes

  • make sure that custom parser is used if passed to process (#1438) (5e098a4)

Features

  • make sure @ triggers directive completion automatically (#1441) (935220a)

2.4.0-alpha.3 (2020-03-20)

Note: Version bump only for package graphql-language-service-server

2.4.0-alpha.2 (2020-03-20)

Bug Fixes

Features

  • optionally provide LSP an instantiated GraphQLConfig (#1432) (012db2a)
  • typescript, tsx, jsx support for LSP server using babel (#1427) (ee06123)
  • graphql-config: add graphql config extensions (#1118) (2a77e47)
  • Symbol support for single document (#1244) (f729f9a)
  • use new GraphQL Config (#1342) (e45838f)

2.4.0-alpha.1 (2020-01-18)

Bug Fixes

Features

  • convert LSP Server to Typescript, remove watchman (#1138) (8e33dbb)

2.3.3 (2019-12-09)

Bug Fixes

  • a few more tweaks to babel ignore (e0ad2c6)

2.3.2 (2019-12-03)

Bug Fixes

2.3.1 (2019-11-26)

Note: Version bump only for package graphql-language-service-server

2.3.0 (2019-10-04)

Features

0.0.1 (2017-03-29)

2.2.0 (2019-10-04)

Features

0.0.1 (2017-03-29)

2.2.0-alpha.0 (2019-10-04)

Features

0.0.1 (2017-03-29)

2.1.1-alpha.1 (2019-09-01)

0.0.1 (2017-03-29)

Note: Version bump only for package graphql-language-service-server

2.1.1-alpha.0 (2019-09-01)

0.0.1 (2017-03-29)

Note: Version bump only for package graphql-language-service-server

2.1.1 (2019-09-01)

0.0.1 (2017-03-29)

Note: Version bump only for package graphql-language-service-server