PHP 和 JS 自动完成功能在 Laravel Blade 中不起作用

问题描述 投票:0回答:1

我正在使用 vscode 并在 laravel 项目上工作,但是 php 自动完成功能甚至在

@php @endphp
内部也无法工作,甚至无法在
{{ }}
内部工作,并且 javascript 自动完成功能也无法在
<script></script>
内部的刀片文件中工作。我使用了 phpstorm 但这是付费的,我在 vscode 中安装了许多扩展以获得我想要的结果,但没有任何效果

这是我的设置

{
  "editor.minimap.enabled": false,
  "breadcrumbs.enabled": false,
  // "workbench.productIconTheme": "a-file-icon-vscode-product-icon-theme",
  "editor.fontLigatures": true,
  "editor.lineHeight": 1.6,
  "files.autoSave": "afterDelay",
  "codeium.enableSearch": true,
  "editor.fontFamily": " 'monospace', monospace",
  "better-comments.tags": [

    {
      "tag": "!!",
      "color": "#F6FF33",
      "strikethrough": false,
      "backgroundColor": "transparent"
    },
    {
      "tag": "?",
      "color": "#3498DB",
      "strikethrough": false,
      "backgroundColor": "transparent"
    },
    {
      "tag": "TODO",
      "color": "#0073ff", 
      "strikethrough": false,
      "backgroundColor": "transparent"
    },
    {
      "tag": "//",
      "color": "#68FF33",
      "strikethrough": false,
      "backgroundColor": "transparent"
    },
    {
      "tag": "**",
      "color": "#FF33EC",
      "strikethrough": false,
      "backgroundColor": "transparent"
    }
  ],
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.fontWeight": "normal",
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "bootstrapAutocomplete.version": "4.6",
  "workbench.iconTheme": "a-file-icon-vscode",
  "[php]": {
    "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
  },
  "intelephense.telemetry.enabled": false,
  "intelephense.completion.triggerParameterHints": true,
  "intelephense.completion.insertUseDeclaration": true,
  "intelephense.trace.server": "messages",
  "intelephense.diagnostics.undefinedClassConstants": false,
  "intelephense.diagnostics.undefinedFunctions": false,
  "intelephense.diagnostics.undefinedConstants": false,
  "intelephense.diagnostics.undefinedProperties": false,
  "intelephense.diagnostics.undefinedTypes": false,
  "intelephense.diagnostics.undefinedMethods": false,
  "terminal.integrated.env.linux": {},
  "console-ninja.featureSet": "Community",
  "bootstrapIntelliSense.version": "Bootstrap v4.6",
  "codeium.enableConfig": {
    "enabled": true,
    "keybindings": {
      
    }
  },
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "editor.fontSize": 15,
  "terminal.integrated.fontSize": 13
}


javascript php visual-studio-code autocomplete settings
1个回答
0
投票

最常见的原因

  1. 冲突的 JavaScript 库: -> 多个 JavaScript 库之间的冲突有时会导致自动完成功能出现故障。要隔离问题,请尝试停用任何额外的 JavaScript 库或插件。

  2. 缺少 jQuery 库: -> JavaScript 元素和 Blade 指令的自动完成通常依赖于 jQuery 和 jQuery UI 框架。确保您的项目正确合并这些库。包含项目公共目录中的缩小版本或使用 CDN URL。

  3. 不正确的文件关联: -> 确保 Blade 文件与 IDE 或文本编辑器中的 HTML 正确关联。您可以将以下配置添加到 Visual Studio Code settings.JSON 文档中: {"files.associations":{"*.blade.php": "html"}}

© www.soinside.com 2019 - 2024. All rights reserved.