question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension shouldn't attempt to fold :class properties in Vue files

See original GitHub issue

With the following code: image

The extension attempts to fold the :classes, resulting in a broken code indentation: image

This can currently be fixed by changing the setting inlineFold.regex to:

(class|className)=[`'{"]([^`'"{}]+)[`'"}]

(added a { in the middle part)

Maybe a better solution could be something like this: (class|className)=([`'"{])([^]+?)\2 but you will probably need to update the capture groups indexes in the code

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
moalamricommented, Sep 20, 2022

@wc-davide Yeah react and jsx brought lots of troubles with the template literal. Your colleagues suggested an interesting method 🧐. I will have a look into that. Since you use normal values in the class and far from using jsx. I think you can simply remove the jsx containers {} and use a whitespace. 👍

UPDATE: I’ve tested your colleague method https://regex101.com/r/XXrZHt/1 I’ve completely forgot that we tried that with no success, as you can see in the last line it will stop at the first occurrence of }, because it is not greedy, we also tried to make it greedy, but it consumed any following attribute as well. That’s why i’m writing a simple non-regex method only for Jsx. I have always wondered why most of compilers has an extra plugin for Jsx alone, but I fully understand it now 😵‍💫

0reactions
moalamricommented, Sep 21, 2022

I’m glad you sorted it out 😃 Maybe in upcoming update I will make the default regex with pre whitespace 👍🏻

Feel free to reopen if you have a suggestion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript and Vue in general · Issue #478 · vuejs/vue - GitHub
The VueTS solution was to have a class extend Vue and define properties as class members thus the instance API is in sync...
Read more >
vue.js - How disable eslint warning for a specific line in a ...
I would like to dismiss this error on my vue file. I am trying to add this processor line
Read more >
Style Guide - Vue.js
Style Guide. This is the official style guide for Vue-specific code. If you use Vue in a project, it's a great reference to...
Read more >
How to Structure a Large Scale Vue.js Application
What is the best way to structure a Vue.js application so that it scales and remains maintainable and extendable the more it grows?...
Read more >
How to Build a Chrome Extension with Vue - SitePoint
James Hibbard shows how to build a simple Chrome extension, which alters the behavior of the new tab page, using the Vue.js framework....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found