emmet icon indicating copy to clipboard operation
emmet copied to clipboard

Change between markup and stylesheets emmets based on context

Open pedro757 opened this issue 3 years ago • 6 comments

A cool feature will be to change between markup and stylesheets emmets based on cursor context, this is a nice feature, specially in filetypes like jsx tsx wherein both kinds of emmets are used.

For example:

import React from 'react';
import styled from 'styled-components'

const Button = styled.button`
  border: 2px solid;
  margin: 0 1em;
`
//  TYPING p10 DOES NOT WORK 

const Home = () => {
  return (
    <>
      <div>hola</div>
      {/*  TYPING (table>tr*3) WORKS  */}
    </>
  );
};

export default Home;

I don't know how to achieve this, maybe treesitter? Any ideas?

pedro757 avatar Sep 17 '21 21:09 pedro757

FYI, here's an example of how to get the filetype from the cursor position with treesitter:

https://github.com/L3MON4D3/LuaSnip/blob/f813c0ae944bcaa5630d1c5cb172009a392cb921/lua/luasnip/extras/filetype_functions.lua#L12

wochap avatar Feb 16 '22 03:02 wochap

Wow. Thank you, I've been thinking on this for a while and I had no clue how to deal with it. I'll check that. @wochap

pedro757 avatar Feb 16 '22 03:02 pedro757

Maybe this can also be used to avoid having emmet completion across all jsx/tsx files and just have completion on return statments

martinsione avatar Feb 16 '22 16:02 martinsione

Do you have any ideas on this?, the thing is that is Lua and my server is in JavaScript.

@wochap

pedro757 avatar Feb 25 '22 03:02 pedro757

No 😢,

wochap avatar Feb 26 '22 14:02 wochap

Comes across to this issue when thinking about this feature

I think this kind of feature can be delegated to a dedicated plugin, e.g. emmet.nvim for neovim, so the focus of this repository is to enhance emmet as an LSP

fitrh avatar Oct 16 '22 13:10 fitrh