Giter VIP home page Giter VIP logo

Comments (3)

nobodywasishere avatar nobodywasishere commented on August 27, 2024

I can make the colors more consistent between contexts but unfortunately it's not possible to match the behavior of LSP as our syntax highlighting is via a tmlanguage grammar (a series of regexes). It may be possible for crystalline to implement syntax highlighting, but that's beyond the scope of this repo.

from vscode-crystal-lang.

wJoenn avatar wJoenn commented on August 27, 2024

If I understand correctly, the type of the file can be declared in the tmlanguage declaration

"fileTypes": [
  "cr"
],

Would there be a way to create a new file for specs with a fileType of spec.cr that would hardcode every spec keywords as either control or the equivalent of a method depending on the keyword maybe ?
Something like these

{
  "comment": "everything being a reserved word, not a value and needing a 'end' is a..",
  "match": "(?<!\\.)\\b(describe|expect|it|expect_raises)\\b(?![?!:])",
  "name": "keyword.control.crystal"
},
{
  "comment": "every 'spec' related method is a..",
  "match": "(?<!\\.)\\b(should|eq|be|be_a|be_nil|be_true|be_false|be_truthy|be_falsey|be_close|contain|match)\\b(?![?!:])",
  "name": "entity.name.function.crystal"
},

That would solve the spec related syntax though and I understand what you mean for the rest, I can't think of a solution to match foo and bar to a different regexp to make one be highlighted as a method and the other as a variable 🤔

Have you ever talked about this to Crystalline's team ?

from vscode-crystal-lang.

nobodywasishere avatar nobodywasishere commented on August 27, 2024

I could add the spec stuff as keywords to the normal language, as they are built-in and available ootb (though only used in specs). I've not talked to the developer of Crystalline about this yet.

from vscode-crystal-lang.

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.