Code Monkey home page Code Monkey logo

vscode-befunge's Introduction

Befunge Support in VS Code

Version Installs Build Status Known Vulnerabilities

Not Maintained

Note that this plugin is no longer maintained. Pull requests will gladly be accepted to update it to conform with new VS Code standards & remove vulnerabilities.

Features

  • Implements Syntax Highlighting in VS Code for Befunge-93 and Befunge-98 programming languages.

  • Adds alignment guides coming from the directional characters (>, v, <, ^, ?).

Associates .bf, .befunge, and .b93 files with Befunge-93, and .b98 files with Befunge-98.

Screenshots

FizzBuzz Example

Factorial Example

Installation

  1. Open VS Code, select the extensions icon (Windows: ctrl + shift + X, Mac: cmd + shift + X) and search for befunge. Or maybe you are already here in VS Code. Nice!
  2. Click install
  3. Restart or reload VS Code when prompted
  4. Add "befunge.guides.enable": true" to your Workspace or User Settings if you want to enable Befunge alignment guides.
    • note: it is recommended that you also add "editor.renderIndentGuides": false to your workspace settings if you enable this
  5. (Optional) add the custom theming described in Extension Settings

Extension Settings

Adds the following new configuration settings:

Name Default (Type) Description
"befunge.guides.enabled" true (boolean) Enable the Befunge guides coming from arrow characters.
"befunge.guides.wrap" false (boolean) Enable the Befunge guides coming from arrow characters to wrap to the other side when the edge of the code torus is hit.
"befunge.guides.color.dark" "#3c3c3c" (#rrggbb hex string) The Befunge guide line color to use for a dark theme.
"befunge.guides.color.light" "#dcdcdc" (#rrggbb hex string) The Befunge guide line color to use for a light theme.

To get the colors shown in the screenshots, some changes to your User Settings are necessary:

  1. Open your user settings (Windows: ctrl + , Mac: cmd + ,)
  2. Add the following json to your User Settings (or Workspace Settings to only enable it on your current workspace):
    // custom colors
    "editor.tokenColorCustomizations": {
        "textMateRules": [

            // Befunge directional character styles
            {
                // bf93: v^><
                // bf98: v^<>x
                "scope": "keyword.control.direction.absolute.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            {
                // bf9*: ?
                "scope": "keyword.control.direction.random.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            {
                // bf98: []
                "scope": "keyword.control.direction.rotate.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            {
                // bf98: r
                "scope": "keyword.control.direction.reflect.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            {
                // bf93: |_
                // bf98: |_w
                "scope": "keyword.control.direction.conditional.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            {
                // bf98: hlm
                "scope": "keyword.control.direction.3d.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#f0bf00"
                    }
            },
            // befunge end character styles
            {
                // bf93: @
                // bf98: @q
                "scope": "keyword.control.end.befunge",
                    "settings": {
                        "fontStyle": "bold",
                        "foreground": "#ff0000"
                    }
            },
            // befunge stack manipulation character styles
            {
                // bf93: :\$
                // bf98: :\$n{}u
                "scope": "keyword.operator.stack.befunge",
                    "settings": {
                        "foreground": "#b405ff"
                    }
            },
            // befunge I/O operators
            {
                // bf9*: &~
                "scope": "keyword.operator.io.input.befunge",
                    "settings": {
                        "foreground": "#128024"
                    }
            },
            {
                // bf9*: .,
                "scope": "keyword.operator.io.output.befunge",
                    "settings": {
                        "foreground": "#128024"
                    }
            },
            {
                // bf98: io
                "scope": "keyword.operator.io.file.befunge",
                    "settings": {
                        "foreground": "#128024"
                    }
            },
            {
                // bf93: pg
                // bf98: pgs
                "scope": "keyword.operator.io.code.befunge",
                    "settings": {
                        "foreground": "#128024"
                    }
            },
        ]
    }

As VS Code does not (yet?) allow themes to be set on a per language basis, this adds to your global theme. However, all scopes used in this blurb end in .befunge, ie, this should not affect your theme anywhere except on Befunge files.

Of course, feel free to modify this to your liking, and look at the scopes contained in the *.tmLanguage.json files to see what other Befunge scopes you can customize the theme for.

Known Issues

  • The vertical alignment guides are not centered. I'm sure there must be a way to do this, but if so I haven't been able to think of it!

Find an issue/bug? Report it!

Contributing

Contributions are encouraged - whether pull requests, bug reports, documentation, or feature requests. Please read, understand, and agree to the Contributing Guidelines & Code of Conduct first.

Source

Github Repository

Release Notes

See also the changelog.

1.2.4

  • multiple dependency updates.

1.2.3

  • Update npm dependencies, addressing several npm vulnerability alerts.

1.2.2

  • Update npm dependencies addressing (another) low priority npm vulnerability alert.

1.2.1

  • Update npm dependencies, addressing Github notification of a dependency vulnerability

1.2.0

  • Restrict colors to 6 digit hex colors as other formats can cause problems, especially with the horizontal lines
  • Purge decorations of the old style when color configuration changes, as otherwise it would persist until editor is closed
  • Renamed "befunge.guides.enable" configuration property to "befunge.guides.enabled" to match README and code
  • Set some default editor configurations for Befunge-93 and 98 files, including turning off indent guides, line highlight, trailing whitespace trimming, autoindent, and quick suggestions
  • Because indent guides are now disabled by default, "befunge.guides.enabled" now defaults to true

1.1.0

  • Support for alignment guides for the directional characters

1.0.0

  • Initial release with support for Befunge-93 and Befunge-98

vscode-befunge's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kagof avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

seanpm2001

vscode-befunge's Issues

Vertical alignment guides are not centered

current behaviour
the vertical alignment guides for this extension come out of the left side of the character.

description of the desired feature (required)
It would be great to find a way to center the vertical alignment guides, so they look like they are "coming out of" the tip of the arrow, instead of the side.

why this feature would be valuable (required)
It would be a bit clearer where the guide is coming from, and it would just be more aesthetically pleasing :)

how to implement this feature
Unknown - help wanted!

Additional context
Anyone with more knowledge on how to do this is very welcome to propose a solution.

implement guide wrapping

current behaviour
When a guide hits the edge of the projection of the code torus, it stops.

description of the desired feature (required)
Befunge operates on a code torus. As such, when the edge of our projection is hit, the program counter moves to the opposite edge. The guide lines could also wrap around to the other side.

why this feature would be valuable (required)
It may be useful to visualize the flow of the program to have these lines wrap.

how to implement this feature
changes to the _findConnectedWhitespaceXX methods

Additional context
This should be off by default, with configuration to enable it:

"befunge.guides.wrap": {
  "type": "boolean",
  "default": false,
  "definitions": "Whether the Befunge guides coming from arrow characters should wrap to the other side when the edge of the code torus is hit."
}

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.