Giter Club home page Giter Club logo

tree-sitter-iex's People

Contributors

jonatanklosko avatar the-mikedavis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

seanpm2001

tree-sitter-iex's Issues

Integrate with GitHub

It would be great to integrate this grammar for GitHub highlighting. Note that this grammar is not likely to be used in files, but it would be useful for highlighting Markdown snippets, like this:

We first compute square of the numbers:

```iex
iex> list = Enum.map([1, 2, 3], fn x -> x * x end)
[1, 4, 9]
```

And that's how we would sum them up:

```iex
iex> Enum.sum(list)
14
```

@patrickt please let us know if you're open to integrating more specific grammars like this one.

Host playground

We can host playground on GH pages and have CI updating the parser file. When we get to a nice setup we can do the same on tree-sitter-elixir.

Handle multiline results

Large IEx results may be formatted into multiple lines, for example:

iex> quote do
...>   Enum.map(x, &(&1 + 1))
...> end
{{:., [], [{:__aliases__, [alias: false], [:Enum]}, :map]}, [],
 [
   {:x, [if_undefined: :apply], Elixir},
   {:&, [], [{:+, [context: Elixir, import: Kernel], [{:&, [], [1]}, 1]}]}
 ]}
Test
================================================================================
Multiline results
================================================================================

iex> quote do
...>   Enum.map(x, &(&1 + 1))
...> end
{{:., [], [{:__aliases__, [alias: false], [:Enum]}, :map]}, [],
 [
   {:x, [if_undefined: :apply], Elixir},
   {:&, [], [{:+, [context: Elixir, import: Kernel], [{:&, [], [1]}, 1]}]}
 ]}

--------------------------------------------------------------------------------

(source
  (evaluation_block
    (prompt_line
      (prompt)
      (expression))
    (prompt_line
      (prompt)
      (expression))
    (prompt_line
      (prompt)
      (expression))
    (result)))

I'm pretty sure we will need to write a C scanner for this ๐Ÿ™ˆ

Update the readme (filetype?)

Appears installed:

Screenshot 2022-01-14 at 08 30 23

Treesitter lua conf:

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.iex = {
  install_info = {
    url = "~/projects/tree-sitter-iex", -- local path or git repo
    -- url = "[email protected]:elixir-lang/tree-sitter-iex.git", -- local path or git repo
    files = {"src/parser.c"}
  },
--  filetype = "zu", -- if filetype does not agrees with parser name
--  used_by = {"bar", "baz"} -- additional filetypes that use this parser
}

I think the problem has to do with the filetype, once we sort this I would be happy to add some extra docs into the readme about how to install/use this.

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.