VSCode AutoComplete和IntelliSense在反号内不起作用 [英] VSCode autocomplete and IntelliSense are not working within backticks

查看:15
本文介绍了VSCode AutoComplete和IntelliSense在反号内不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Gatsby项目工作。当我在反号(`)、模板文字中键入代码时,VSCode不会显示智能感知或自动完成。我安装了一堆代码片段扩展。但这似乎并没有解决问题。我正在使用更漂亮的扩展名,这会导致这种情况吗?

import React from "react"
import MainMenu from "./MainMenu"

import styled, { createGlobalStyle } from "styled-components"



const GlobalStyles = createGlobalStyle`
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap');

// Autocomplete and IntelliSense are not working in this part and it's pretty slow to type styles without those.
//
body{
  font-family: 'Roboto Mono', monospace;
}
`
const LayoutWrapper = styled.div`

//Here same thing
//
  max-width: 960px;
  margin: 0 auto;
`

const Layout = ({ children }) => (
  <div>
    <GlobalStyles />
    <MainMenu />
    <LayoutWrapper>{children}</LayoutWrapper>
  </div>
)

export default Layout

推荐答案

VS代码不附带对styled-components样式内联css的内置支持。尝试安装此扩展:https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components

为js和ts中的样式组件添加语法突出显示和智能感知:

这篇关于VSCode AutoComplete和IntelliSense在反号内不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆