-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(In-progress) Streamline creation of development environment and add usage documentation. #5
Draft
theKnightsOfRohan
wants to merge
12
commits into
CWood-sdf:main
Choose a base branch
from
theKnightsOfRohan:fix/devenv
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3267922
fix(treesitter): register nml & ncss filetypes
rohanseth2006 dfaea5c
docs(env): add instructions for setting up banana env
rohanseth2006 8839d34
refactor(module): move up static Instance methods and move down unrel…
theKnightsOfRohan 8c1ddcf
docs(instance): mark internal methods
theKnightsOfRohan e3d88d1
docs(API): mark _functions as internal and add basic comments
theKnightsOfRohan cd8a92d
docs(issues): add issue templates
theKnightsOfRohan dbdf5c6
I forgor :|
theKnightsOfRohan 03c31c7
docs(usage): add initial guide to project structure and hello world
theKnightsOfRohan 13d6857
Merge branch 'main' into fix/devenv
theKnightsOfRohan 32e6387
fix(init): resolve merge conflicts
theKnightsOfRohan c7da637
Merge branch 'main' into fix/devenv
theKnightsOfRohan 7d6cfec
fix: resolve merge conflicts
theKnightsOfRohan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Bug Report | ||
description: File a bug report | ||
title: "[Bug]" | ||
labels: bug | ||
body: | ||
- type: textarea | ||
id: issue | ||
attributes: | ||
label: Description of the issue | ||
description: What's the issue you encountered? | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: repro | ||
attributes: | ||
label: Reproduction steps | ||
description: How can the issue be reproduced? | ||
placeholder: Describe each step as precisely as possible | ||
validations: | ||
required: true | ||
# TODO: Figure out banana logger :| | ||
# | ||
# - type: textarea | ||
# id: log | ||
# attributes: | ||
# label: Log file | ||
# description: loggy loggy | ||
# validations: | ||
# required: true | ||
- type: input | ||
id: version | ||
attributes: | ||
label: Neovim Version | ||
description: In your terminal, run `nvim --version` | ||
placeholder: "e.g. 0.10.1" | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: config | ||
attributes: | ||
label: Minimal Snippet | ||
description: For ease of replication in the case of complex behaviour, paste a small snippet with which the bug occurs. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: additional-context | ||
attributes: | ||
label: Additional context? | ||
description: | | ||
- Additional info about your environment: | ||
- Any other information relevant to your issue. | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Feature Request | ||
description: Suggest a new feature. | ||
title: "[Feature Request]" | ||
body: | ||
- type: textarea | ||
id: overview | ||
attributes: | ||
label: Overview | ||
description: Include the basic, high-level concepts for this feature here. If this is an API request, please provide a link to the browser documentation. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: details | ||
attributes: | ||
label: Smaller details | ||
description: These may include specific methods of implementation etc. Take a look at `TODO.md` in order to see if your request is related to any other planned features. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: feature | ||
attributes: | ||
label: Why would this feature be useful? | ||
description: This could include a specific project scenario, or a common inefficiency you have noticed. | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Usage | ||
|
||
Below is a minimal config for using banana during development: | ||
|
||
```lua | ||
return { | ||
dir = "~/path/to/project/directory", | ||
build = function() | ||
require("banana").installTsParsers() | ||
end, | ||
config = function() | ||
require("banana").initTsParsers() | ||
end, | ||
} | ||
``` | ||
|
||
Because banana uses custom parsers for nml and ncss, they must be registered and compiled manually by treesitter. With this config, you are able to get fancy-schmancy syntax highlighting for ncss and nml. | ||
|
||
## Project Setup | ||
|
||
Banana's hello world uses the below directory structure: | ||
|
||
``` | ||
PWD | ||
├── jumpstart.lua | ||
├── banana | ||
│ └── random_name | ||
│ └── index.nml | ||
└── lua | ||
└── example | ||
└── init.lua | ||
``` | ||
|
||
The `jumpstart.lua` file will contain the following code, which will not change: | ||
|
||
```lua | ||
-- jumpstart.lua | ||
|
||
local instance = require("banana").newInstance("stuff/clock", "random buffer name") | ||
|
||
vim.keymap.set("n", "<leader>o", function() | ||
instance:open() | ||
end, {}) | ||
``` | ||
|
||
By sourcing this file using the `:so` command, you are able to toggle opening and closing the banana page instance. This file is used for launching pages directly. If you want to launch your page later, as part of your plugin logic, then all you need to do is place these lines in whatever configuration that your plugin needs. | ||
|
||
Notice that the banana nml package and the lua package don't have the same name. Banana does not require any sort of name coupling between the names of packages requiring each other; you can expect banana's require to have similar behaviour to that of lua's require. (Remember that banana uses "/" instead of ".") | ||
|
||
## Project Content | ||
|
||
Alright, enough preamble, it's time to get to the fun part. One thing that's important to remember when developing a banana plugin is that the nml is your entry point into your banana page; all of your lua scripts are called from that nml page. With that in mind, let's take a look at the following nml file: | ||
|
||
```html | ||
<nml> | ||
<head> | ||
<style> | ||
nml { | ||
width: 50%; | ||
height: 50%; | ||
} | ||
div { | ||
hl-bg: red; | ||
width: 50%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div>Hello World!</div> | ||
</body> | ||
</nml> | ||
``` | ||
|
||
Awfully underwhelming, huh? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this seems really great, thank you so much for doing this!
However, there are a few things that you have setup that I disagree with:
if instance == nil ...
in the keymap)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other thing: maybe have a top and left property on the nml selector just to show that the user can change the position with those properties
The rest of this all looks really great and I'm really looking forward to when I can merge this into main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll specify that the jumpstart file should not be part of the actual plugin, it's just a way to open the page itself for simpler projects. That's why I had it outside the normal project file structure. I haven't had as much time as I would like to work on the docs due to being out of the country, but now I can incorporate your feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha, thanks for clarifying, I was a bit confused by that