Coder Social home page Coder Social logo

Comments (4)

danieldietrich avatar danieldietrich commented on May 18, 2024

I stumbled upon one issue: I need to find strings within strings in order to nested highlight whitespace.

Here is an Xtend example:

whitespace detection

Langium example (whitespace = XXX + javascript code other than string contents):

const generated = s```
XXXclass A {
XXXXXX${members.map(member => {
XXXXXXXXXswtichX(member.type)X{
XXXXXXXXXXXXcaseX'method':XreturnXs```
XXXXXXXXXXXXXXXTODO: generate method
XXXXXXXXXXXX```
XXXXXXXXX}
XXXXXX}
XXX}

I do not have access to the AST (because it lives in the language server and the whitespace highlighter extension only has access to the editor contents), so I plan to implement a 'stack' parser that is aware of

  1. comments (in order to skipt strings within comments)
  2. strings (in order to find whitespace and align contents)
  3. template literal substitutions (in order to recurse in javascript code from within a string context)

from langium.

spoenemann avatar spoenemann commented on May 18, 2024

The changes in #825 break the highlighting provided by our vscode extension. @danieldietrich how shall we proceed with this? Remove the functionality for now, or make it work with the new API?

from langium.

danieldietrich avatar danieldietrich commented on May 18, 2024

@spoenemann could you please elaborate on the highlighting error by providing a screenshot? Let's see if there is a quick workaround...

from langium.

spoenemann avatar spoenemann commented on May 18, 2024

It just doesn't show any whitespace highlighting. I assume it's because the s function has been replaced by two functions expandToString and expandToNode?

from langium.

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.