Coder Social home page Coder Social logo

razetime / bqn-vscode Goto Github PK

View Code? Open in Web Editor NEW
22.0 5.0 6.0 168 KB

BQN programming language vscode plugin (symbol input, syntax highlighting)

License: MIT License

JavaScript 9.76% TypeScript 32.82% Shell 5.21% Lua 52.21%
bqn syntax-highlighting vscode vscode-extension vscode-extensions vscode-language

bqn-vscode's Introduction

BQN VS Code plugin

This VS Code extension provides language support for BQN.

It is available on the Open VSX Registry and the VS Code Marketplace.

Setup

This extension has a focus on the CBQN implementation. The REPLXX=1 option must be enabled during building for best results.

Configurable Settings

You can add these settings to your settings.json file to disable some of the default behaviours of this extension.

  • bqn.executablePath - Path to the CBQN executable e.g. /home/username/CBQN/BQN.
  • bqn.saveBeforeLoadScript - Whether vscode should save the script before loading it into the CBQN REPL.
  • bqn.sendToNewReplDelay - How long vscode should wait before sending text to a repl.
  • bqn.executableSupportsReplxx - Marks whether the executable set in bqn.executablePath is built with replxx support.
  • bqn.pendingBackslashBackgroundColor - Style customization feature for backslash completion.
  • bqn.enableBackslashCompletion - true by default. If you have an extension that interferes with backslash completion (e.g. Vim keybindings), please set this to false and use a system-wide method.
  • bqn.enableHoverDocumentation - Controls whether documentation will be displayed for a symbol on mouseover.

Features

Current

  • Syntax highlighting.
  • Backslash symbol completion (\r -> ) using the standard BQN keymap, like in the online REPL.
  • Symbol completion by function name (take<tab> -> ).
  • Help popups when hovering over glyphs.
  • File, line, and selection execution in the integrated terminal (from @suhr and @mk12). This requires having a bqn executable in your PATH, or customizing the bqn.executablePath setting.

Planned

  • Block context highlighting for symbols like 𝕨 and 𝕣.
  • Inline code execution similar to nvim-bqn.
  • CBQN WASM interpreter bundled with the extension.
  • Add a symbol table to the sidebar for clickable BQN symbols.

bqn-vscode's People

Contributors

kettukaa avatar mk12 avatar razetime avatar selaere avatar suhr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bqn-vscode's Issues

Add completion by function name

Would it be possible to add a completion based on function name, akin to BQNPAD completion? It really lowers the barrier of entry, when you can type shape and get a correct symbol, when you don't remember them all by heart yet.

BQN icon not shwon

For some reason, the icon for BQN files is not shown in the file explorer panel.

image

Minor discoloring with ‿

image
First line has first Hello being blue, second is white, and _hello is also white.
Second and third line show that for underscore names it's broken in a similar way.

theoretically you should write arrays of vars with lowercase and no underscores anyways, but sometimes i want to signify that an array of values will be used as functions, or just a specific value.

Dubble struck character description not showing

when i hover over a double struck character, the descriptions aren't showing. I haven't tested all symbols, but after testing all double struck characters 𝕩𝕏𝕗𝔽𝕘𝔾𝕣 and a few other non struck symbols, it seems only the double strucked are broken.

How to add strand using backslash?

Forgive my ignorance, but I am trying to add ‿ using the vscode extension, but aside from ctrl-space and searching, I can't seem to get it to work.

Would love some pointers here, and thank you for such a great extension!!

Latin1 characters aren't added yet

Latin1 characters (àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ) don't seem to be highlighted correctly
Example:
image
(note, that π isn't broken. It only appears green because the character before it is broken)

How to tell vscode about bqn?

This is my settings.json

"security.workspace.trust.untrustedFiles": "open",
"window.zoomLevel": 2

}

{
"editor.formatOnSave": true,
"haskell.hlint.logLevel": "warn",
"haskell.hlint.run": "onSave",
"haskell.formattingProvider": "ormolu",
"bqn.executablePath": "/usr/local/bin/bqn",

// May be necessary

// "haskell.hlint.executablePath": ""
}

on my Ubuntu 22.10. But it errors out with Ctr-Shift-Enter with The terminal process failed to launch: Path to shell executable "cbqn" does not exist. Should I just do a symbolic link? Total Beginner to vscode, BTW.

Word completion includes too many characters

VS Code has a word completion feature that looks at words that are in any of the currently open files. For BQN, it includes characters that aren’t part of the identifier:

bqn-vscode-word-completion.mp4

In the above screen capture, the expected word completions are modifier1 and modifier2.

Another feature of VS Code is to highlight the word that the cursor is currently on. This seems to include too many characters as well, and this is probably caused by the same:

Screenshot

Using BQN language v0.1.5.

Bow Tie \Z added?

The fork upstream fixing? Pull request or abandonware, as it would affect my source tree decision.

Backslash substitution does not work properly when Vim extension is enabled

When used together with the Vim extension, if the cursor is before a character, completing a backslash substitution places the cursor after that character, instead of after the newly inserted character. For instance, in the below screen capture, the cursor is expected to be positioned before the f instead of after the f after the substitution:

bqn-vscode-cursor.mp4

Another issue is that, when entering a command (press : in normal mode), backslashes cannot be inserted into the command; they are instead inserted into the file:

bqn-vscode-backslash.mp4

Using BQN language v0.1.5 and Vim v1.26.0.

Character insertion when using vim plugin

I am using the vim plugin. I don't know if this is an issue with them or with this plugin, or just the interactions between the two.
When I want to insert a bqn primitive to the left of some other text, the cursor jumps one character too far to the right.

E.g. If I have a file with contents:

Hello, World!

If the cursor is between the o and r in world, and I want to type a special character like ↕, the cursor ends up between r and l, instead of still being before r.

Curiously, this only happens when entering some characters. The 'double letters' like 𝕩 and 𝕎 don't have the same problem.

Syntax highlighting not working properly.

Hello,

Coming from BQNpad I expected a similar experience in VSCode, colour-wise. However, I can't seem to get BQN's syntax highlighting to work. Here's how it look:
image

Is anyone else having this issue?

Input by primitive name

I'm a beginner and I can't remember how to type the primitives, and looking them up all the time is too time-consuming. I wonder if there is a solution to this.

In some other languages, I can type \circ to get the symbol. I realize there's a conflict between having \c immediately converting to versus it being the start of \circ, but I wonder if there's some way to get functionality that's similar in spirit. Perhaps a separate mode for primitive-name entry where it doesn't convert until I press tab, or a separate prefix key for verbose entry.

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.