Giter VIP home page Giter VIP logo

nev's Introduction

Nev

Build and tests

This is still very early in developement and very experimental. Use at your own risk!

Previously named Absytree.

Programming Language + Editor

Nev is a text editor + programming languange workbench where instead of writing the source code as text in text files, the abstract syntac tree (AST) is edited directly (or rather through projections, which are still trees) Languages will be extendable with custom AST node types, by either translating those to nodes of other languages or by implementing code generation for the backend (at the moment only WASM).

The editor is available for the terminal and as a desktop GUI app.

Goals

  • For the text editor:
    • Sit somewhere inbetween Vim and VS Code
    • The most important tools are built in (e.g. syntax highlighting with tree-sitter, LSP support)
    • Can be used purely as a text editor (ignoring the AST language framework)
    • Little to no configuration needed to get nice experience out of the box
    • Support Vim motions
  • General goals:
    • Keyboard focused (only basic mouse support)
    • Easily extendable with scripting
    • Good performance

Inspirations

Important notes if you intend to use it

  • Current only UTF-8 encoded files are supported
  • Language servers, Treesitter parsers and debug adapters have to installed manually at the moment
  • Read the docs

Docs

Screenshots

Nev running inside Windows Terminal -> WSL -> Zellij with transparent background

alt


LSP integration

alt


Git integration

alt


Debugging support (breakpoints aren't rendered correctly in the gif because of recording with asciinema and they use unicode symbols, see screenshot above)

alt


Global and open file finders (and more)

alt


Global search

alt


Themes

alt


LSP completions

alt


Diagnostics, inlay hints and hover information

alt


Fuzzy search for document symbols

alt


View changed/added files in git, and open the diff for files directly, or stage/unstage/revert them

alt


View the git diff in the editor

alt


nev's People

Contributors

nimaoth avatar

Stargazers

A. M.  avatar Alexandru Ungur avatar  avatar Luiz avatar Pradeep Gowda avatar Nilts avatar Firas Khalil Khana avatar Alex Michaud avatar  avatar  avatar  avatar adam avatar Stephen avatar  avatar Regis Caillaud avatar Adam M avatar Miguel Martin avatar Mamy Ratsimbazafy avatar Anne Thorpe avatar Tuan Duc Tran avatar Mason Dear avatar Angga avatar hyperdarker avatar Antonis Geralis avatar Nahuel Piguillem avatar  avatar David avatar Sultan Al Isaiee avatar Matthew Macomber avatar Thales Rodolfo avatar Nikolaus Schlemm avatar dh avatar  avatar Daniel Robinson avatar Hoang Phan avatar Yevhen Ts. avatar Patitotective avatar Yanis Zafirópulos avatar  avatar YC avatar Jack Tang avatar  avatar  avatar Jaremy Creechley avatar Kamil Chmielewski avatar Willi Kappler avatar Akito avatar  avatar  avatar Basil Ajith avatar Adrian Veith avatar jg avatar  avatar Alaya Abdullahi avatar Stephan Renatus avatar niko avatar Adam Blažek avatar Hugo Granström avatar  avatar Archar Gelod avatar Cristian Camilo Ruiz avatar Mutsuha Asada avatar Bung avatar Shuu avatar Scott Wadden avatar  avatar Sven Sackers avatar Constantine Molchanov avatar Michael Bradley avatar Solitude avatar Pixeller avatar Hyunsoo Lee avatar Tommo Zhou avatar Andrew Johnson avatar Russell Matney avatar  avatar  avatar

Watchers

Solitude avatar DrunkenAlcoholic avatar  avatar  avatar  avatar Mason Dear avatar

nev's Issues

Issues with mouse scroll wheel.

It possible to scroll the code off the screen when using the scroll wheel. It should probably lock same place where the up and down arrow keys do.

Build error

nimble build results in Error: cannot open '/home/solitude/git/app/Absytree/src/ast.nim'

Improve how settings are handled

Currently settings are not declared anywhere, the code just uses them by specifying the name and a default value using

getOption[int](configProvider, "editor.max-search-results", 1000)

Problems:

  • No place to put documentation for settings
  • No easy way to get complete list of settings
  • No auto completion/name checking when compiling

The new system should allow the following:

  • Declare builtin settings in one place or multiple places but grouped by scope
  • Specify documentation, type info etc. for each setting
  • Allow plugins to declare their own settings
  • Get compiler to check correct usages of builtin settings in compiler source and plugins
  • Still allow accessing settings using string path

Once that is done a finder can be implemented similar to browse-keybinds to explore all available settings

Switch text content representation to rope

Current representation is an array of lines.
Finish Sum tree and rope implementations and integrate into the editor.

Advantages:

  • Better performance for large files
  • Immutable snapshots of buffer content which can be shared between threads
    • Saving, treesitter parsing/reparsing, etc can be done in background thread without blocking UI
  • Easier sharing of buffer content without having to pass around the entire TextDocument

Implement permissions/capabilities for plugins

Plugins should only be allowed to perform certain actions when the user gives explicit permission.
The permissions should be very fine grained.

  • Running external processes
    • Language servers are a special case probably
    • Allow giving access to specific executables/everything
  • Making network connections
    • Specifiy individual hosts/ports
  • Accessing the file system
    • Specify read/write access for individual folders/everything
  • Reading buffer content
    • Specify permissions per file/folder
    • Permissions:
      • Full content
      • Full content but with secrets replaced by * (depends on #18)
      • No access
  • Anything else?

Open questions:

  • Pass permissions around through functions?
    • (+) Permissions can be handled more fine grained inside plugin (useful if plugin uses libraries)
    • (-) Lots of extra argument
  • Or: Specify permissions for entire wasm module
    • (+) Simpler
  • Allow passing of permissions between plugins?
    • E.g. Plugin A with permission to read specific folder calls function from plugin B without any permissions but utility functions for reading files and passes it the permission for specific folder

Implement proper jumplist

Currently there is a cursor history (per editor) and editor history

  • List of locations (file + line + column)
  • Which moves should go into the jump list?

Program fails to build on Arch Linux

Hi, thank you for sharing your cool project!

However, it seems that it fails to compile on my system for some reason.

Could you let me know if this is OS specific problem?

---------------------System Info ---------------------
OS: Arch Linux x86_64
Kernel: 6.6.9-arch1-1
Shell: bash 5.2.21
DE: KDE Plasma 5.27.10
WM: KWin (Wayland)
WM Theme: Breeze
Theme: Breeze (Dark) [QT], Breeze [GTK2/3]
Icons: breeze-dark [QT], breeze-dark [GTK2/3/4]
Font: Fira Sans (10pt) [QT], Fira Sans (10pt) [GTK2/3/4]
Cursor: breeze (24px)
Terminal: foot 1.16.2
Terminal Font: Noto Sans Mono (10pt)
CPU: 11th Gen Intel(R) Core(TM) i7-11800H (16) @ 4.60 GHz
GPU 1: Intel UHD Graphics
GPU 2: NVIDIA GeForce RTX 3070 Mobile / Max-Q
Memory: 31.20 GiB

---------------------Executed Commands ---------------------

nimble setup
nimble buildDesktop --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true

--------------------- Error Log ---------------------
Executing task buildDesktop in /home/anon/Programs/Absytree/absytree.nimble
extension:
Additional command line params: --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
Hint: used config file '/home/anon/Programs/Absytree/config.nims' [Conf]
.........................................................................
Compiling for linux
.............................................................
Terminal backend enabled
................................
/home/anon/Programs/Absytree/src/misc/custom_async.nim(9, 13) Warning: use the nimble packages malebolgia, taskpools or weave instead; threadpool is deprecated [Deprecated]
.......................................................................
/usr/lib/nim/compiler/modulegraphs.nim(15, 39) Error: cannot open file: ../dist/checksums/src/checksums/md5
stack trace: (most recent call last)
/tmp/nimblecache-659962185/nimscriptapi_2224927682.nim(210, 16)
/home/anon/Programs/Absytree/absytree.nimble(56, 3) buildDesktopTask
/usr/lib/nim/system/nimscript.nim(285, 7) selfExec
/usr/lib/nim/system/nimscript.nim(285, 7) Error: unhandled exception: FAILED: /usr/bin/nim c -o:ast -d:exposeScriptingApi --app:console -D:forceLogToFile -D:enableGui=false -D:enableTerminal=true ./src/absytree.nim [OSError]
Tip: 1 messages have been suppressed, use --verbose to show them.
nimscriptwrapper.nim(160) execScript

Error:  Exception raised during nimble script execution

Build failure

Building latest commit with nim 2.0.6 fails with

In file included from /home/solitude/git/app/Nev/nimbledeps/pkgs2/nimwasmtime-0.1.7-54d6dba8f74ac561053551462447a7498bec84ef/wasmtime/crates/c-api/include/wasmtime.h:182,
                 from /home/solitude/git/app/Nev/nimbledeps/pkgs2/treesitter-0.1.15-3bb5409058f8c1b2c651c990880370bdf0ef7b24/treesitter/lib/src/./wasm_store.c:17,
                 from /home/solitude/git/app/Nev/nimbledeps/pkgs2/treesitter-0.1.15-3bb5409058f8c1b2c651c990880370bdf0ef7b24/treesitter/lib/src/lib.c:14:
/home/solitude/git/app/Nev/nimbledeps/pkgs2/nimwasmtime-0.1.7-54d6dba8f74ac561053551462447a7498bec84ef/wasmtime/crates/c-api/include/wasi.h:12:10: fatal error: wasmtime/conf.h: No such file or directory
   12 | #include <wasmtime/conf.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

Can't compile: `[..]/Absytree/src/platform/platform.nim(1, 8) Error: cannot open file: vmath`

I can't compile the editor. Weirdly, vmath package can't be imported despite being installed.

$ nim --version                                                                                                             in bash at 14:35:19
Nim Compiler Version 2.0.2 [Linux: amd64]
Compiled at 2023-12-15
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: c4c44d10df8a14204a75c34e499def200589cb7c
active boot switches: -d:release
$ nimble --version                                                                                                          in bash at 14:42:37
   Warning: Using project local deps mode
nimble v0.14.2 compiled at 2023-12-15 01:05:41
git hash: couldn't determine git hash

Compile to wasm instead of js

Currently the browser version is based on js

Problems:

  • Slow (bad Nim->JS codegen, interaction with DOM (technically not necessary))
  • Optimizations are either good for native and bad for js or the other way round
    • E.g. Native prefers object, stack allocation etc., JS prefers ref object and preventing copies
  • Lots of wrapping around APIs because JS backend and native backend are so different
  • Issues with big int

Advantages of wasm:

  • Closer to native backend -> ptr, cast etc work properly
  • Better performance

Rendering should probably switch to WebGL

Open questions:

  • How to do interface between WASM <-> JS with async functions

Implement LSP textDocument/rename

  • Add command editor.text.rename <name> which does the LSP request
  • Add keybinding with anonymous command / another command which takes the variables under the cursor and opens the command line with .rename <name> where <name> is the variable under the cursor
  • Cursor in command line should be at same position in the name as it was in the original text document

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.