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

Sticky Scroll isn't working for .vue files #157891

Closed
danielgroen opened this issue Aug 11, 2022 · 13 comments
Closed

Sticky Scroll isn't working for .vue files #157891

danielgroen opened this issue Aug 11, 2022 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-sticky-scroll info-needed Issue requires more information from poster

Comments

@danielgroen
Copy link

According due the new nice feature that allows sticky view in editors there is a bug with .vue files.

It keeps hanging on the <template> tag, no matter how far you scroll.

Related issue.

I have tested this issue on:

  • Mac os
  • 1.71 Insiders
@danielgroen
Copy link
Author

@gjsjohnmurray This is the new issue i created

@gjsjohnmurray
Copy link
Contributor

@danielgroen what does the Outline view for your file show? If you're not sure where to find this, run the command View: Focus on Outline View.

@danielgroen
Copy link
Author

@danielgroen what does the Outline view for your file show? If you're not sure where to find this, run the command View: Focus on Outline View.

afbeelding

@gjsjohnmurray
Copy link
Contributor

Sticky scroll relies on the same information as Outline. It looks like you don't have an extension which implements DocumentSymbolProvider for your files.

@danielgroen
Copy link
Author

danielgroen commented Aug 11, 2022

i've installed an extention that impolemented documentSymbolProvider. Now i got this:
afbeelding

However it's still stuck on the <template>

@aiday-mar aiday-mar assigned aiday-mar and unassigned mjbvz Aug 11, 2022
@aiday-mar aiday-mar added triage-needed editor-sticky-scroll bug Issue identified by VS Code Team member as probable bug and removed triage-needed labels Aug 11, 2022
@aiday-mar
Copy link
Contributor

Hi thanks for the feedback. Could you share the .vue file to copy paste? I will try to reproduce the issue on my computer.

@aiday-mar aiday-mar added the info-needed Issue requires more information from poster label Aug 11, 2022
@danielgroen
Copy link
Author

<template>
    <div class="drop-down__wrapper">
        <aside v-if="hasPrefix" class="drop-down__prefix">
            <slot name="prefix" />:&nbsp;
        </aside>
        <div
            v-if="dropdownState === 'idle'"
            :class="[
                'drop-down',
                `drop-down--${color}`,
                `drop-down--${alignment}`,
                { 'drop-down--open': dropdownIsOpen }]"
        >
            <li class="hidden-words">
                {{ dropdownValues.default.name }}
            </li>
            <li v-for="option in options" :key="option.id" class="hidden-words">
                {{ option.name }}
            </li>
            <div class="drop-down__current" @click="changeDropdownState()">
                <span class="drop-down__current__word">{{ getCurrentName }}</span>
                <AtomSvg class="drop-down__current__svg" type="chevrondown" />
            </div>
            <ul class="drop-down__selections">
                <li
                    v-if="!dropdownValues.default.id"
                    disabled
                    :class="[
                        'drop-down__selections__word',
                        { disabled: dropdownValues.required || !dropdownValues.current.id },
                    ]"
                    @click="changeValue('default')"
                >
                    {{ dropdownValues.default.name }}
                </li>
                <li
                    v-for="(option, i) in options"
                    :key="option.id"
                    :class="[
                        'drop-down__selections__word',
                        { disabled: dropdownValues.current.name === option.name },
                    ]"
                    :val="option.id"
                    @click="changeValue(i)"
                >
                    {{ option.name }}
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
import { defineComponent, onMounted, onBeforeUnmount, computed } from '@nuxtjs/composition-api';

import useDropdown from '@/composables/useDropdown';

export default defineComponent({
  name: 'AtomDropdown',
  props: {
    options: {
      type: Array,
      required: true
    },
    color: {
      type: String,
      default: 'white',
      validator: color => !!['white', 'sand'].includes(color)
    },
    alignment: {
      type: String,
      default: 'left',
      validator: color => !!['left', 'right'].includes(color)
    }
  },

  setup ({ options }, { slots }) {
    const {
      dropdownValues,
      reset,
      setOptions,
      dropdownIsOpen,
      changeState,
      dropdownState,
      changeDropdownState
    } = useDropdown();

    const hasPrefix = !!slots.prefix;

    onMounted(() => {
      reset();
      setOptions(options);
      changeState('idle');
    });

    onBeforeUnmount(() => {
      reset();
    });

    const getCurrentName = computed(() => {
      if (dropdownValues.value.current.name) {
        return dropdownValues.value.current.name;
      } else {
        return dropdownValues.value.default.name;
      }
    });

    const changeValue = (i) => {
      if (i === 'default') {
        dropdownValues.value.current = { id: null, name: null };
      } else {
        dropdownValues.value.current = dropdownValues.value.options[i];
      }
      changeDropdownState();
    };

    return { dropdownValues, hasPrefix, changeValue, dropdownIsOpen, changeDropdownState, dropdownState, getCurrentName };
  }
});
</script>

<style lang="scss" scoped>
.drop-down {
}
</style>

@gjsjohnmurray
Copy link
Contributor

@danielgroen thanks for pasting that. Which extension did you add to get Outline content?

@danielgroen
Copy link
Author

document this

However i now see that the stickyness work on the javascript!

@danielgroen
Copy link
Author

danielgroen commented Aug 12, 2022

However, maybe this is a new feature request, but can it also be sticky in the <template> part?

@aiday-mar
Copy link
Contributor

I just tested on my computer on the latest VSCode Insiders version which you can find here https://code.visualstudio.com/insiders/. For the sticky scroll to work you need a language service provider extension. I used the Vue Language Features developed by vue which you can find in the marketplace of VSCode. The new behavior is as follows:

sticky-scroll-vue

@danielgroen
Copy link
Author

Great it works! Thanks. I indeed had the deprecated ext volar still installed since vue language features had some bugs back in the days

@Jacobify
Copy link

@danielgroen thanks for addressing this issue. and thanks for resolving it @gjsjohnmurray @aiday-mar

@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-sticky-scroll info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

6 participants