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

Add "vue", "svelte" & "angular" to scope_languages #845

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

ynhhoJ
Copy link
Contributor

@ynhhoJ ynhhoJ commented Mar 7, 2024

Resolves #844

Before:
image

After:
image

@ynhhoJ ynhhoJ marked this pull request as draft March 7, 2024 23:48
@ynhhoJ ynhhoJ marked this pull request as ready for review March 7, 2024 23:48
@ynhhoJ ynhhoJ changed the title Add "css" & "vue" to scope_languages Add "css", "scss" & "vue" to scope_languages Mar 8, 2024
@ynhhoJ ynhhoJ marked this pull request as draft March 8, 2024 08:19
@ynhhoJ ynhhoJ marked this pull request as ready for review March 8, 2024 08:25
@ynhhoJ ynhhoJ changed the title Add "css", "scss" & "vue" to scope_languages Add "css", "scss", "vue", "svelte", "angular" & "graphql" to scope_languages Mar 8, 2024
@lukas-reineke
Copy link
Owner

Have you read :help ibl.config.scope? I don't believe any of these are scope.

@ynhhoJ
Copy link
Contributor Author

ynhhoJ commented Mar 8, 2024

Have you read :help ibl.config.scope? I don't believe any of these are scope.

Yeah, i think you are right there. Those are indentation from treesitter.

Is there way to configure node_types for languages what are not present in scope_languages.lua?

This code does not has any effect:

require("ibl").setup {
      indent = { char = "" },
      scope = {
        include = {
          node_type = {
            css = {
              "block",
              "declaration",
            },
          },
        },
      },
    }

@ynhhoJ ynhhoJ marked this pull request as draft March 8, 2024 11:52
@ynhhoJ ynhhoJ force-pushed the features/new-lang-scopes branch from 1064298 to 39187aa Compare March 8, 2024 11:52
@ynhhoJ ynhhoJ changed the title Add "css", "scss", "vue", "svelte", "angular" & "graphql" to scope_languages Add "css", "scss", "vue", "svelte", "angular" to scope_languages Mar 8, 2024
@ynhhoJ
Copy link
Contributor Author

ynhhoJ commented Mar 8, 2024

@lukas-reineke , i updated languages_scope file.
Can you verify if everything is good, please?

CSS

image

Code
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {}

body {
  .test {
    color: black;
  }
}
SCSS

image

image

image

image

Code
@use "sass:math";

@function scale-below($value, $base, $ratio: 1.618) {
  @while $value > $base {
    $value: math.div($value, $ratio);
  }
  @return $value;
}

$normal-font-size: 16px;
sup {
  font-size: scale-below(20px, 16px);
}

$sizes: 40px, 50px, 80px;

@each $size in $sizes {
  .icon-#{$size} {
    font-size: $size;
    height: $size;
    width: $size;
  }
}

@mixin reset-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

@mixin horizontal-list {
  @include reset-list;

  li {
    display: inline-block;
    margin: {
      left: -2px;
      right: 2em;
    }
  }
}
Vue

image

Code
<template>
  <div>
    <h1>{{ pageTitle }}</h1>
    <p>{{ description }}</p>

    <!-- Example input field binding -->
    <label for="inputText">Enter text:</label>
    <input id="inputText" v-model="inputText" />

    <!-- Example conditional rendering -->
    <div v-if="showMessage">
      <p>{{ message }}</p>
    </div>

    <!-- Example list rendering -->
    <ul>
      <li v-for="item in itemList" :key="item.id">
        {{ item.name }}
      </li>
    </ul>

    <!-- Example method call on button click -->
    <button @click="handleButtonClick">Click me!</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pageTitle: 'Vue.js Example',
      description: 'A basic Vue.js component example.',
      inputText: '',
      showMessage: false,
      message: 'This is a message!',
      itemList: [
        { id: 1, name: 'Item 1' },
        { id: 2, name: 'Item 2' },
        { id: 3, name: 'Item 3' },
      ],
    }
  },
  methods: {
    handleButtonClick() {
      // Example method logic
      this.showMessage = true
    },
  },
}
</script>

<style scoped>
/* Example scoped styles */
h1 {
  color: #333;
}

p {
  font-size: 16px;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  margin-bottom: 8px;
  cursor: pointer;
}
</style>

@ynhhoJ ynhhoJ marked this pull request as ready for review March 8, 2024 12:05
@lukas-reineke
Copy link
Owner

I still don't think this is right. CSS variable scoping works very differently to normal languages. This is not easy to display with the indentation.

https://blog.logrocket.com/css-variables-scoping/

I don't think adding CSS and SCSS will work.

Vue and Angular are fine.

@ynhhoJ ynhhoJ force-pushed the features/new-lang-scopes branch from 39187aa to 49eb8b4 Compare March 12, 2024 07:14
@ynhhoJ ynhhoJ changed the title Add "css", "scss", "vue", "svelte", "angular" to scope_languages Add "vue", "svelte", "angular" to scope_languages Mar 12, 2024
@ynhhoJ ynhhoJ changed the title Add "vue", "svelte", "angular" to scope_languages Add "vue", "svelte" & "angular" to scope_languages Mar 12, 2024
@ynhhoJ
Copy link
Contributor Author

ynhhoJ commented Mar 12, 2024

I removed SCSS & CSS from language_scope.lua

Copy link
Owner

@lukas-reineke lukas-reineke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@lukas-reineke lukas-reineke merged commit 3d08501 into lukas-reineke:master Mar 14, 2024
7 of 8 checks passed
@ynhhoJ ynhhoJ deleted the features/new-lang-scopes branch March 14, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does not work for CSS & Vue
2 participants