Language-tools: Unexpected token. Did you mean `{'>'}` or `>`?

Created on 30 May 2020  ·  46Comments  ·  Source: sveltejs/language-tools

svelte

Describe the bug
On a perfectly good app.svelte file I'm getting the above.

System (please complete the following information):

  • OS: Windows
  • IDE: VSCode
  • Plugin/Package: Svelte Beta
bug good first issue

All 46 comments

Could you paste the complete code of that file?

This is probably because of the code before it got transformed with a missing brackets. Can you provide the code before it?

<script>
  import { onMount } from "svelte";
  import u from "./Helper/utils.js";
  import msgbox from "./Components/msgbox.js";
  import Tabs from "./Components/tabs.svelte";
  import Button from "./Components/Button.svelte";
  import InboxTab from "./Main/Inbox.svelte";
  import ArchiveTab from "./Main/Archive.svelte";
  import HelpTab from "./Main/Help.svelte";
  import SettingsTab from "./Main/Settings.svelte";
  import DocOutTab from "./Main/DocOut.svelte";

  let mainid = "mainid";
  let server = "";
  let TABS;
  let timer = null;
  // let RTL = false;

  onMount(() => {
    u.addPrototypes();

    TABS.addtab({
      name: "inbox",
      description: "$Inbox$",
      icon: "gi-save-file", //icons.faFolderOpen
    });
    TABS.addtab({
      name: "docout",
      description: "$Docs Out$",
      icon: "gi-open-file", //icons.faFilter
    });
    TABS.addtab({
      name: "archive",
      description: "$Search Letters$",
      icon: "gi-search", //icons.faFilter
    });
    TABS.addtab({
      name: "settings",
      description: "$Settings$",
      icon: "gi-cog", // icons.faCog
    });
    TABS.addtab({
      name: "help",
      description: "$Help$",
      icon: "gi-question-sign",
    });

    setTimeout(() => {
      // kludge to get the server for fetch
      u.GET("/api/getuser").then((r) => (server = r));

      // server = window.ServerURL;
      u.GET("/api/inbox.getsettings").then((data) => {
        if (data.Color) {
          u.SetTheme(data.Color);
        }
        if (data.Language == "fa") {
          document.body.dir = "rtl";
          // document.documentElement.style.setProperty("--tblAlign", "right");
        }
      });
      TABS.setInitial();
    }, 0);

    // Heartbeat for auto update
    timer = setInterval(() => {
      u.GET("/api/getuser").catch(() => {
        clearInterval(timer);
        msgbox.Ok("$Connection Failed!$", "", () => window.location.reload(true));
      });
    }, 10 * 1000);
  });

  // register all tabs to be created here for Tab component
  function createTab(tabname, id, props) {
    var tab = null;

    switch (tabname) {
      case "inbox":
        tab = new InboxTab({
          target: document.getElementById(id),
        });
        break;
      case "help":
        tab = new HelpTab({
          target: document.getElementById(id),
        });
        break;
      case "archive":
        tab = new ArchiveTab({
          target: document.getElementById(id),
        });
        break;
      case "settings":
        tab = new SettingsTab({
          target: document.getElementById(id),
        });
        break;
      case "docout":
        tab = new DocOutTab({
          target: document.getElementById(id),
        });
        break;
    }

    return tab;
  }

  // function configeditor() {
  //   // console.log("here");
  // }
</script>

Pasting the given code into an App.svelte of a starter template works for me. Anything else we should know about your setup or the file?

I'm not an expert, so you will have to tell me what/where to look for.

Can you also provide the markup and the skyle tag?

I found the culprit:

<svelte:head>
  <link rel="stylesheet" href="/lib/jodit.es2018.min.css" />
  <script src="/lib/jodit.es2018.min.js"> 

  </script>
</svelte:head>

It's the script tag in the head section that messes up the parser.

Was this page helpful?
0 / 5 - 0 ratings