GithubHelp home page GithubHelp logo

luke-zhang-04 / processing-vscode Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 3 MB

A Visual Studio Code extension for the Processing programming language (https://processing.org/)

Home Page: https://marketplace.visualstudio.com/items?itemName=Luke-zhang-04.processing-vscode

License: MIT License

TypeScript 70.02% JavaScript 29.98%
processing vscode vscode-extension pde processing-python vscode-language-support

processing-vscode's Introduction

icon

Processing for Visual Studio Code

Marketplace Version

Installs Rating .github/workflows/CI.yml License Maintained? Vulnerabilities

Note on Processing 4: I'm not sure how this extension will handle Processing 4. I will wait for it to be out of beta and fix the extension if needed.

Contents

What this extension is

This is a fork of a Visual Studio Code extension created by Tobiah Zarlez to add Processing language support, with added documentation on hover, diagnostics, and more.

What this extension isn't

  • This extension does not allow you to debug Java or Processing projects.
  • This is NOT a language server, and hence cannot provide the features a language server can. There simply is not enough demand for a Processing language server, and that type of thing is definitely out of the scope of my abilities. Language servers take entire teams from big companies such as Microsoft to make.
    • This extension cannot provide IntelliSense, for example

Why the fork?

The original extension was missing some features that I wanted and it seemed as if the repo was no longer being maintained. So, forked the extension and changed some things.

  • Better syntax highlighting (from Red Hat Java)
  • Documentation on hover (via Regex)
  • A run button (both Processing Java and Processing Python)
  • Simple diagnostics (via the processing-java CLI, which can be extremely slow, and is disabled by default)
  • Strings are auto closing and surrounding (didn't work in the old extension)

See the CHANGELOG for all changes

Screenshots

Hover

More Screenshots

Hover Error

Feature list

Syntax highlighting

Open any .pde file, or choose "Processing" from the drop down menu in the bottom right corner. Syntax highlighting is from Red Hat's Java extension.

Snippets

Once the language has been set, you will see code snippets pop up automatically as you type!

Documentation on hover

When you hover over a function such as square, documentation for this function will appear! Documentation is scraped directly from the Processing reference page, so anything missing from there will be missing here too.

Commands

Installing this extension will add the following commands to your command pallette (CTRL+SHIFT+P, or opened by View -> Command Pallette). These commands can be selected and run from there, to complete the corresponding tasks.

  • Open Extension Documentation
    • Opens this documentation.
  • Open Documentation for Selection
    • Use the pallet command "Processing: Open Documentation for Selection" to open the processing documentation for the current selection.
    • By default uses processing.org's documentation. Can change to p5js's if preferred using the processing.docs setting.
  • Run
    • Runs the current Processing project (from current working directory). Will automatically detect if the project is Processing Java or Python.
    • If the setting processing.shouldSendSigint is set to true, run will interrupt the current running processing program before running the new one.
  • RunJava
    • Runs the current Processing Java project (from CWD)
  • RunPy
    • Runs the current Processing Python project (from CWD)
  • Search Processing Website
    • Use the pallet command "Processing: Search Processing Website" to quickly search whatever you want on the processing website.
    • By default uses Google for search. Can change to DuckDuckGo if preferred using the processing.search setting.

Using Task Files

The original extension made use of a tasks.json file to run processing projects. This has been replaced with the run command and run button (processing.Run). You can bind this command to a keybinding.

Alternatively, if you prefer the tasks.json file, you can continue to use it, but the command field should be changed to "${config:processing.path}".

Processing Python

This extension attempts to make Processing with Python easier to use. Follow these steps:

  1. Download the processing-python library for your operating system
    • Take note of the location of this file. For example, I might store mine in ~/processing.py-linux64/processing.py-3056-linux64/processing-py.jar
  2. Download the proper Java version for your operating system
  3. Configure the extension
    • Change the following configuration options
      • processing.py.jarPath: the path to your processing-py.jar file. Preferably, this is an absolute path. In this example, it will be ~/processing.py-linux64/processing.py-3056-linux64/processing-py.jar
      • processing.py.javaPath: the path to your java executable. For example, /usr/bin/java
      • Make sure processing.py.isEnabled is set to true (true by default)
  4. Downloads stub definitions (optional)

Credits

Development

  • Run yarn vsce package
  • Run code --install-extension processing-vscode-<VERSION>.vsix

processing-vscode's People

Contributors

anandchowdhary avatar atnbueno avatar austince avatar avinzarlez avatar brianmcfadden avatar codevogel avatar detsudetsu avatar hysysk avatar jerrylususu avatar luke-zhang-04 avatar smsutherland avatar tqwewe avatar

Stargazers

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

Watchers

 avatar  avatar

processing-vscode's Issues

Processing executable path with spaces not running

This issue persists.
I've tried to add double quotes to the processing-java path setting, but even then the command runs without quotes.

Looking at c240d8b , seems you solved this issue only at the sketch path. The spaces on run are still a problem

C:"Program Files"\processing\processing-java works on cmd, but it doesn't in the Processing Path setting variable

image

Originally posted by @bisclever in #1 (comment)

problem with tasks.json and processing.path

Hello,
I try to use your Processing impl for VS code, but that's don't work because there is a problem with config:processing.path in the tasks.json that's work fine with the Tobiah Zarlez version.
In your comment in VS code I don't find anyhing about the tasks.json. so I don't know what I must do to solve this problem.

Variable ${config:processing.path} can not be resolved because setting 'processing.path' not found.

I'm on Processing 4.02b with an Mac OS Monterey.

Thanks for your work

Python imports availability

First of all, congrats for this great extension.

I just wanted to ask if it is possible to import other modules beside processing while using this extension. I was unable to import keras datasets which are available during regular python programming.

Thanks in advance

[FEATURE] Auto run when a instance is already running

Thanks for this great plug-in!

A little issue I have is that processing.Run won't run an instance that is already running, it would be really helpful if the plugin could kill the previous running instance and rerun, kind of like pressing ctrl-c in the terminal for us.

Changes to handling configuration

  • Use vscode.workspace.onDIdChangeConfiguration (or something of that sort) so the extension knows when the config has been changed
  • Don't throw on bad configuration value, just return the default

[BUG] Not sizing window correctly, and not redrawing...

Describe the bug
I wrote a code snippet for my intro programming class. The code is supposed to render a few 2D shapes, and then move the rectangle based on the mouse location.

Within Processing it works as expected (and with p5.js). However within VSCode, there are two issues:

  1. The window is not sized correctly, it always shrinks to some default
  2. The window does not rerender, and thus the rectangle does not follow the cursor.

To Reproduce
Run the following code in VSCode and compare with Processing & p5.js

//Let's begin by specifying our functions
int center_x;
int center_y;

void setup(){
    size(1024,768);
    // using the size(), let's find the center points for x,y
    center_x = (width/2);
    center_y = (height/2);
};

void draw(){
    //Draw a background so we don't get trails
    background(180);
    //Let's define our circle, then draw it!
    fill(58,232,250,100);
    strokeWeight(5);
    stroke(75);
    ellipse(center_x, center_y, 200, 200);

    /*Now for the square
    First we set the render point to be center-based instead of top-left,
    then define the other parameters*/
    rectMode(CENTER);
    fill(52,237,36,100);
    strokeWeight(5);
    stroke(75);
    rect(mouseX, mouseY, 500, 500);

    //TRIANGLE!!!
    fill(250, 58, 58, 100);
    stroke(75);
    strokeWeight(5);
    /* required size: width(800) x height(750)
    let's set our three corners based on deviations from the center
    deviation from center will be +- 400 along x, +- 375 along y */
    triangle(center_x-400, center_y+375, center_x, center_y-375, center_x+400, center_y+375);

    //Sure I guess we can do a crosshair...
    stroke(0);
    strokeWeight(10);
    line(center_x-50, center_y, center_x+50, center_y);
    line(center_x, center_y-50, center_x, center_y+50);
}

VSCode (please complete the following information):

  • OS: Windows 11
  • Version 1.71.0
Version: 1.71.0 (user setup)
Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c
Date: 2022-09-01T07:36:10.600Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22622
Sandboxed: No

[BUG]

Hello,

I'm not sure it's a bug, but now when I hit "CMD + SHIFT + B" my sketch failed with this message

 *  Terminal will be reused by tasks, press any key to close it. 

zsh:1: command not found: processing-java

 *  The terminal process "/bin/zsh '-c', 'processing-java --force --sketch=/Users/stanislasmarcais/EN_COURS/CODE/github/PROJET/Mosaique --output=/Users/stanislasmarcais/EN_COURS/CODE/github/PROJET/Mosaique/out --run'" terminated with exit code: 127. 
 *  Terminal will be reused by tasks, press any key to close it. 

I don't understand this message, yesterday that's command work like a charm... and today no. Maybe I changed something in my configuration. But when I pass by the command palette and use Processing: Run Open Processing Java Project that's work. It's very weird.
So if you have an idea of what happen, that's can be great.

[BUG] Project Does Not Exist

I seem to be running into an issue where, when hitting the play button, the terminal says my project doesn't exist. I've double and triple-checked my path to the Processing folder and nothing seems to be working. I also made sure to add the tasks.json file, and only open the folder I'm working in, but each time I hit the play button, it simply gives me this:

$ processing-java --sketch=c:\Users\Gman9\ProcessingStuff\NoC_RWalker --run
c:UsersGman9ProcessingStuffNoC_RWalker does not exist.

And then doesn't run anything. Any ideas on why this might be occurring?

*I am on Windows 10

Formatting

Look into modifying an existing java formatter for Processing

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.