question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work in .vue components files - except highlighting

See original GitHub issue

Actual Behavior

Query code does not work in .vue files.

When I try to write query on .vue <script> nothing works except syntax highlighting (so I guess extension detect’s code block correctly). No auto completions, suggestions etc. But in .ts, .graphql and other files everything works perfectly, so my API schema if for sure loaded correctly.

It does not matter if I use gql or #graphql.

Also, .vue does work fine in vscode Apollo extension, but not in this one.

Expected Behavior

It should work in .vue components.

In extension features it’s listed

Load the extension on detecting gql tag in js, ts, jsx, tsx, vue files

Also I can see vue in extension source code.

So I think this extension supposed to support vue out of the box?

Steps to Reproduce the Problem Or Description

demo.vue

<template>
  <div />
</template>

<script setup>
const demo = `#graphql
  query {
    me {
      id,
      email
    }
  }
`
</script>

.graphqlrc.js

module.exports = {
  schema: 'http://localhost:8085/graphql'
};

or

module.exports = {
  schema: 'http://localhost:8085/graphql',
  documents: 'src/**/*.{graphql,js,ts,jsx,tsx,vue}'
};

Tried multiple config approach, nothing works. But again, I thing it supposed to detect .vue automatically anyway?

Specifications

  • GraphQL for VSCode Extension Version: v0.3.50 or v0.3.41
  • VSCode Version: 1.63
  • OS Name: Linux Mint
  • OS Version: 20.2
  • .graphqlrc.js multiple formats

Logs Of TS Server || GraphQL Language Service

1/2/2022, 10:27:49 PM [3] (pid: 66114) graphql-language-service-usage-logs: {"type":"usage","messageType":"initialize"}

[Info  - 21:27:49.99] Starting TS Server 
[Info  - 21:27:49.99] Using tsserver from: /usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info  - 21:27:49.101] <syntax> Forking...
[Info  - 21:27:49.107] <syntax> Starting...
[Info  - 21:27:49.108] <semantic> Forking...
[Info  - 21:27:49.111] <semantic> Starting...

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
acaocommented, Feb 22, 2022

It’s on the roadmap! just need to add a vue parser to findGraphQLTags in graphql-language-service-server.

please can someone find and mark all the duplicate vue and svelte tickets across vscode-graphql and graphiql?

1reaction
jycouetcommented, Jul 15, 2022

Correct, in svelte you can do js:

<script>
    import { query, graphql } from '$houdini'

    const { data } = query(graphql`
        query SpeciesInfo {
            species(id: 1) {
                name
                flavor_text
                sprites {
                    front
                }
            }
        }
    `)
</script>

or ts:

<script lang="ts">
    import { query, graphql } from '$houdini'

    const { data } = query<SpeciesInfo>(graphql`
        query SpeciesInfo {
            species(id: 1) {
                name
                flavor_text
                sprites {
                    front
                }
            }
        }
    `)
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Syntax highlighting is broken · Issue #660 · vuejs/vetur - GitHub
Problem. Syntax highlighting isn't working across the board. ... i switched from ia32 to x64 vue file syntax highlighting stopped working.
Read more >
Does VSCode support Vue without adding extensions?
By "works fine", I mean VSCode has correct syntax highlighting, some IntelliSense, formatter and error checking, for html/css/js. VSCode has no intention to...
Read more >
Disabling and enabling inspections - WebStorm - JetBrains
When you suppress an inspection, the code analysis engine doesn't highlight the problem found by this inspection in the specific piece of code...
Read more >
How To Debug Components, State, and Events with Vue.js ...
Clicking this will open AirportCard.vue in your editor. With your component file opened, go ahead and add the following highlighted code:.
Read more >
ESLint and Prettier with Vite and Vue.js 3 - Vue School Blog
ESLint is not only able to detect errors in your code, but in many cases, ... as it provides syntax highlighting and more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found