Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pug syntax highlights edge cases #2758

Open
4 tasks done
CamilleDrapier opened this issue Mar 5, 2021 · 1 comment
Open
4 tasks done

Pug syntax highlights edge cases #2758

CamilleDrapier opened this issue Mar 5, 2021 · 1 comment

Comments

@CamilleDrapier
Copy link

Info

  • Platform: Linux
  • Vetur version: v0.33.0
  • VS Code version: 1.54.0

Problem

Some patterns seem to break the syntax highlight for the whole file (I'm using "Single File Components"), more specifically it appears that these cases are problematic (but still valid pug syntax):

  • if the left-side of the affectation is alphabetical-only and the first word of the right-side is "type" and there are some other words afterwards.
    image

  • if the the left-side of the affectation is not alphabetical-only and there is no space before the closing )
    image

  • if the left-side of the affectation is not alphabetical-only and there is and affectation within ` ` and nothing else that would be delimited by a space
    image

Reproducible Case

  1. Call a simple component with a ... placehoder:
<template lang="pug">
  A(
    ...
  )
</template>
  1. Replace ... by one of the following:
  • a=type c=d
  • a=type :c=d e=f
  • @a=b) and remove the next/remaining )
  • :a=b) and remove the next/remaining )
  • :a=b :c=d) and remove the next/remaining )
  • @test=`a = b`
  • :test=`a = b`
  • :test=`a = ${b}`
  • :test=`a = b(c)`
  • :test=`a = b;`
  • :test=`a = b c = d`
  1. You should be able to notice the problem.

  2. Here are other similar examples that are currently working properly:

  • a=b
  • a=b)
  • a="b" c="d"
  • a="b" c=d
  • :a)
  • :a=b)
  • :a=b )
  • :a=b c=d)
  • :a=b c)
  • test=`a`
  • test=`${a}`
  • test=`a(b)`
  • test=`a = b`
  • test-test=`a = b`
  • test_test=`a = b`
  • :test=`a`
  • :test=`${a}`
  • :test=`a(b)`
  • :test=`a == b`
  • :test=`a === b`
  • :test=`a = b `
  • :test=`a = b c`
@yoyo930021
Copy link
Member

https://github.com/vuejs/vetur/issues?q=is%3Aissue+is%3Aopen+pug

We don't have enough time to develop or maintenance pug part.
The PR is welcome. If anyone can help, There will be a lot of improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants