Code Monkey home page Code Monkey logo

Comments (10)

tgenuino avatar tgenuino commented on August 11, 2024 5

I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom

{
  "configurations": {
    "Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true}
    , "ReactPug": {
      "file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true,
      "custom_template_tags": {
        "pug": "scope:text.pug"
      }
    }
  }

}

from babel-plugin-transform-react-pug.

tgenuino avatar tgenuino commented on August 11, 2024 1

I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom

{
  "configurations": {
    "Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true}
    , "ReactPug": {
      "file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true,
      "custom_template_tags": {
        "pug": "scope:text.pug"
      }
    }
  }

}

@tgenuino Hi, I tried your method, but it does nothing for me. I am using Ecmascript-Sublime for js by default. Do I need some other way to turn the JSCustom config on?

This is my config on JSCustom. Thanks.

Screen Shot 2019-03-21 at 2 38 46 PM

Select the sintax "JS Custom - ReactPug"

image

On windows, I think its inside User -> Js Cust...

from babel-plugin-transform-react-pug.

jimmychu0807 avatar jimmychu0807 commented on August 11, 2024 1

@tgenuino, thank you

from babel-plugin-transform-react-pug.

ezhlobo avatar ezhlobo commented on August 11, 2024

@actuallymentor cool, I believe that the idea will be as simple as for Atom, but will try to help you with that soon.

from babel-plugin-transform-react-pug.

ezhlobo avatar ezhlobo commented on August 11, 2024

@actuallymentor I had a chance to make small research. Here is what I found: to get correct syntax highlighting for Flow (and maybe more things) there is a plugin borela/naomi.

To get syntax highlighting for pug in js we can create own syntax there and inherit existed one:
— Example: https://gist.github.com/subhaze/a754c8d17906f2a25ce2
— Documentation: http://www.sublimetext.com/docs/3/syntax.html

from babel-plugin-transform-react-pug.

actuallymentor avatar actuallymentor commented on August 11, 2024

Thank you for helping out so quickly!

I've read the documentation, but I don't fully understand it yet, could you elaborate on:

  • What you mean by 'Flow'?
  • In the .sublime-syntax:
    • How does one set the 'parent' highlight? I want to use Babel + this custom template literal. I'm guessing the gist sets it with meta_content_scope: text.html.basic.embedded.js
    • How does one include pug into the template literal scope? With the gist you link I am managing to make the literal highlight html (probably because of include: 'scope:text.html.basic') but I have no idea what the scope name of other syntaxes is supposed to be

from babel-plugin-transform-react-pug.

actuallymentor avatar actuallymentor commented on August 11, 2024

So I figured out how to make the literal understand pug:

%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Js with Template Literals
file_extensions:
  - js
scope: source.js.literal
contexts:
  main:
    - match: ""
      push: scope:source.js
      with_prototype:
      - match: 'pug`' <-- this matched a literal only if it is prepended by pug
        push:
          - meta_content_scope: text.html.basic.embedded.js
          - include: 'scope:text.pug' <-- This sets the highlighting ro pug
          - match: '`'
            pop: true

I still don't really understand how to involve babel in all of this...

from babel-plugin-transform-react-pug.

freemember007 avatar freemember007 commented on August 11, 2024

I have resovle it perfectly by use Ecmascript-Sublime sublime extentsion!

git clone https://github.com/bathos/Ecmascript-Sublime to you sublime Packages path,
then modify its ecmascript.sublime-syntax source file.

@see:
bathos/Ecmascript-Sublime#62

this is the appearance:
img

from babel-plugin-transform-react-pug.

jimmychu0807 avatar jimmychu0807 commented on August 11, 2024

I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom

{
  "configurations": {
    "Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true}
    , "ReactPug": {
      "file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true,
      "custom_template_tags": {
        "pug": "scope:text.pug"
      }
    }
  }

}

@tgenuino Hi, I tried your method, but it does nothing for me. I am using Ecmascript-Sublime for js by default. Do I need some other way to turn the JSCustom config on?

This is my config on JSCustom. Thanks.

Screen Shot 2019-03-21 at 2 38 46 PM

from babel-plugin-transform-react-pug.

JGJP avatar JGJP commented on August 11, 2024

Does anybody here have any luck getting LSP-Typescript to show type hints inside js attributes in pug?

from babel-plugin-transform-react-pug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.