简体   繁体   English

VSCODE 中的 Graphql 文件路径自动补全

[英]Graphql file path autocompletion in VSCODE

Looks like my vscode refuse to give me auto-completion on.graphql file import path… Do you have any idea why?看起来我的 vscode 拒绝给我自动完成 on.graphql 文件导入路径......你知道为什么吗? 错误

I've specific Gql extension activated…我已经激活了特定的 Gql 扩展......

Name: GraphQL for VSCode
Id: kumar-harsh.graphql-for-vscode
Description: GraphQL syntax highlighting, linting, auto-complete, and more!
Version: 1.15.3
Publisher: Kumar Harsh
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=kumar-harsh.graphql-for-vscode

Also definition TS也定义 TS

declare module '*/get-course.gql' {
  import { DocumentNode } from 'graphql';
  const defaultDocument: DocumentNode;
  export const GetCourses: DocumentNode;

  export default defaultDocument;
}

It doesn't give auto-complete in js file neither…它也不会在 js 文件中提供自动完成功能……

Thank in advance…预先感谢…

I know it is an almost 2 years old question but I just encountered the same problem.我知道这是一个将近 2 年的问题,但我刚刚遇到了同样的问题。

I just wanted to post the answer for anyone with the same problem.我只是想为有同样问题的任何人发布答案。

Installing this very popular Path Intellisense ( ~5M downloads ) plugin solved my problem and VSCode started showing autocompletion for my graphql files.安装这个非常流行的Path Intellisense~5M 下载)插件解决了我的问题,VSCode 开始显示我的 graphql 文件的自动完成。

Before installing the plugin :安装插件之前 在此处输入图像描述

After installing the plugin :安装插件后 在此处输入图像描述

Looks.graphql filetypes are not included in default vs code autocomplete plugin. Looks.graphql 文件类型不包含在默认 vs 代码自动完成插件中。

You can install GraphQL prisma.vscode-graphql or similar plugin to achieve this.您可以安装 GraphQL prisma.vscode-graphql 或类似插件来实现此目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM