Skip to content

Commit

Permalink
Merge pull request #6 from Luke-zhang-04/staging
Browse files Browse the repository at this point in the history
Added
-   feat: add python run button

Changed
-   fix(docs): trim documentation hover data
-   fix: don't show hover docs on single line comments
  • Loading branch information
Luke-zhang-04 authored May 22, 2021
2 parents 383b014 + cb48fd3 commit c8dfd9e
Show file tree
Hide file tree
Showing 24 changed files with 6,071 additions and 3,388 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
* text=auto eol=lf

# Don't diff or textually merge documentation data
src/documentation-data.json binary
data/documentation-data.yml binary

.eslintrc.js linguist-detectable=false
rollup.config.js linguist-detectable=false
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ jobs:

- name: build
run: yarn tsc

- name: lint
run: yarn lint

- name: check with prettier
run: yarn prettier . --check
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
src/documentation-data.json
data/*
src/*.yml
*/node_modules/
build
.serverless
.vscode
lib/
tsconfig*.json
legacy
processing-vscode.js
5 changes: 3 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
.github
.vscode/**
data/
src/**
.editorconfig
.gitignore
.prettierrc.yml
fetchDocs.mjs
tsconfig.json
tslint.json
**/*.map
yarn.lock
rollup.config.js
node_modules
node_modules/
scripts/
*.log
legacy/
media/
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2021-05-21

### Added

- feat: add python run button

### Changed

- fix(docs): trim documentation hover data
- fix: don't show hover docs on single line comments

## [2.1.0] - 2021-05-02

### Added
Expand Down
110 changes: 67 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img width="25%" src="./images/icon.png" alt="icon"/>

# Processing for Visual Studio Code

[![.github/workflows/CI.yml](https://img.shields.io/github/workflow/status/Luke-zhang-04/processing-vscode/Node.js%20CI?label=CI&logo=github)](https://github.com/Luke-zhang-04/processing-vscode/actions)
Expand All @@ -6,83 +8,105 @@
[![Installs](https://vsmarketplacebadge.apphb.com/installs-short/Luke-zhang-04.processing-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=Luke-zhang-04.processing-vscode)
[![Rating](https://vsmarketplacebadge.apphb.com/rating-star/Luke-zhang-04.processing-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=Luke-zhang-04.processing-vscode)

Jump to the [Feature List](#Feature-list)
## Contents

## What this extension is
- [What this extension is](#what-this-extension-is)
- [What this extension isn't](#what-this-extension-isnt)
- [Why the fork?](#why-the-fork)
- [Screenshots](#screenshots)
- [Feature list](#feature-list)
- [Syntax Highlighting](#syntax-highlighting)
- [Snippets](#snippets)
- [Documentation on Hover](#documentation-on-hover)
- [Commands](#commands)
- [Processing Python](#processing-python)
- [Credits](#credits)

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 is

Note: You should probably uninstall the old extension as the syntax highlighting will conflict
This is a [fork of a Visual Studio Code extension created by Tobiah Zarlez](https://github.com/TobiahZ/processing-vscode) to add [Processing](https://processing.org/) 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. It also doesn't include any sort of intellisense.
- 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 definetly out of the scope of my abilities. Langauge servers take entire teams from big companies such as Microsoft to make.
- This extension cannot provide intellesence, for example

## Why the fork?

The [original extension](https://github.com/TobiahZ/processing-vscode) 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 (thanks to [Red Hat](https://github.com/redhat-developer/vscode-java/blob/master/syntaxes/java.tmLanguage.json))
- Documentation on hover
- A run button
- Simple diagnostics
- Strings are auto closing and surrounding
- Better syntax highlighting (from [Red Hat Java](https://github.com/redhat-developer/vscode-java/blob/master/syntaxes/java.tmLanguage.json))
- 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](https://github.com/Luke-zhang-04/processing-vscode/blob/main/CHANGELOG.md) for all changes

## Screenshots

![Hover](https://raw.githubusercontent.com/Luke-zhang-04/processing-vscode/main/media/hover-1.png)

<details>
<summary>More Screenshots</summary>

![Hover](https://raw.githubusercontent.com/Luke-zhang-04/processing-vscode/main/media/hover-2.png)
![Error](https://raw.githubusercontent.com/Luke-zhang-04/processing-vscode/main/media/error.png)

</details>

## Feature list

### Syntax highlighting

Open any .pde file, or choose "Processing" from the drop down menu in the bottom right corner.
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](https://github.com/redhat-developer/vscode-java/blob/master/syntaxes/java.tmLanguage.json).

### 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!
When you hover over a function such as `square`, documentation for this function will appear! Documentation is scraped directly from the [Processing reference page](https://processing.org/reference/), 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.

## Command: Open Extension Documentation

Opens this documentation.

## Command: 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.

## Command: Run

Runs the current processing project (from current working directory). Also includes a run button in the editor menu

## Command: 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.

## Proper Hover, Intellisense, and Diagnostics

Problems with the current approach:

- Hover works with word matching, so comments show documentation on hover
- There's no intellsense, only the built in VSCode word matching
- Diagnostics rely on processing-java, which makes it very slow, and also has no option to cache the build

Despite all these problems however, this extension probably will stay this way. Why? Because there isn't nearly enough demand to make a "proper" extension that popular languages such as Python do. Making an extension like this would require me to write a parser and generate an AST, far too much work for a language that I won't really be using outside of my class, and way outside of my abilities. If someone really wants to do this, they can go ahead, I guess.
- 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
- 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.

## Processing Python

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

1. Download the [processing-python library](https://py.processing.org/tutorials/command-line/#requirements) 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](https://py.processing.org/tutorials/command-line/#requirements) for your operating system
- Follow the steps in the [Processing docs](https://py.processing.org/tutorials/command-line/#requirements)
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`
4. Downloads stub definitions (optional)
- Definitions can be found [here](https://github.com/Abdulla060/Processing.py-intellisense/blob/master/lib/Processing3.pyi)
- After than, follow the imports in [this example](https://github.com/Abdulla060/Processing.py-intellisense/blob/master/Example.py)

## Credits

Snippets are based on the [Processing Sublime Text plugin](https://github.com/b-g/processing-sublime).
Syntax highlighting is based on the [Red Hat VSCode-Java extension grammar](https://github.com/redhat-developer/vscode-java/blob/master/syntaxes/java.tmLanguage.json)
- Snippets are based on the [Processing Sublime Text plugin](https://github.com/b-g/processing-sublime).
- Syntax highlighting is based on the [Red Hat VSCode-Java extension grammar](https://github.com/redhat-developer/vscode-java/blob/master/syntaxes/java.tmLanguage.json)
- Thanks to [Tobiah Zarlez](https://github.com/TobiahZ) for making the [original extension](https://github.com/TobiahZ/processing-vscode)
Loading

0 comments on commit c8dfd9e

Please sign in to comment.