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.

Sort on save not working for edge cases

See original GitHub issue

Might have something to do with the released feature in #161

Consider this code where font-custom is a custom font family defined in the config.

<a-col class="font-custom text-15px font-bold leading-20px">
    Hello World
</a-col>

When sorting this code (either via on save or manually) is this the result.

<a-col class="font-custom font-bold font-bold leading-20px">
    Hello World
</a-col>

The font size has been replaced incorrectly and there are now duplicate classes present.

Please not that if the classes are recorded might some other combination or duplication of classes happen. In other words, the sorting is not consistent between runs.

Extension version: v0.20.1

EDIT: It looks like the problem happens when a class name that is last in the list needs to be moved.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexanderniebuhrcommented, Aug 12, 2021

@IgnisDa for my test project I use, where it also breaks:

const { defineConfig } = require('windicss/helpers')

module.exports = defineConfig({
  darkMode: 'media',
  theme: {
    extend: {
      colors: {
        primary: {
          DEFAULT: ({ opacityVariable, opacityValue }) => {
            if (opacityValue !== undefined) {
              return `rgba(var(--primary-dynamic), ${opacityValue})`
            }
            if (opacityVariable !== undefined) {
              return `rgba(var(--primary-dynamic), var(${opacityVariable}, 1))`
            }
            return `rgb(var(--primary-dynamic))`
          },
          50: 'var(--primary-50)',
          100: 'var(--primary-100)',
          200: 'var(--primary-200)',
          300: 'var(--primary-300)',
          400: 'var(--primary-400)',
          500: 'var(--primary-500)',
          600: 'var(--primary-600)',
          700: 'var(--primary-700)',
          800: 'var(--primary-800)',
          900: 'var(--primary-900)',
        },
      },
      cursor: {
        'ns-resize': 'ns-resize',
        'col-resize': 'col-resize',
        'n-resize': 'n-resize',
        's-resize': 's-resize',
      },
      lineClamp: {
        sm: '2',
      },
    },
  },
  plugins: [
    require('windicss/plugin/forms'),
    require('windicss/plugin/line-clamp'),
    require('windicss/plugin/typography'),
  ],
  shortcuts: {
    nrmlz: {
      '-webkit-text-size-adjust': '100%',
      'font-family': `ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,
      'line-height': '1.5',
      margin: '0',
    },
    fit: {
      width: 'max-content',
    },
  },
})
0reactions
alexanderniebuhrcommented, Aug 15, 2021

should be fixed in 0.21.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Are these the sort of edge cases I should think of when using ...
Your edge case tests are: Save a string of 49 characters - success; Save a string of 50 characters - success (or perhaps...
Read more >
Algorithms: Common edge cases in JS | by Jeremy Gottfried
1. Accepted data structure. The first major edge case is the unaccepted data structure. My bubble sort algorithm only works predictably for ...
Read more >
U4-10646 - Sorting nodes in edge cases can lead to blanking ...
U4-10646 - Sorting nodes in edge cases can lead to blanking out of property data ... The sort dialog currently allows you to...
Read more >
Common Microsoft Edge Problems, and How to Fix Them
Having trouble with Microsoft Edge? You may run into issues with the maturing browser, so we provided a list of possible problems and...
Read more >
Don't Forget The Edge Cases - GeeksforGeeks
Let's make it a bit more easy, by assuming that test for input data type is already in place, so you receive only...
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