Skip to content
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

chore(docs): prepare for sdk usage #2

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @gorillamoe
10 changes: 7 additions & 3 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 💥
labels:
- Semver-Major
- breaking-change
- title: Documentation 📚
labels:
- documentation
- title: Exciting New Features ✨
labels:
- Semver-Minor
- enhancement
- title: Bug Fixes 🐛
labels:
- Semver-Patch
- bug
- title: Dependencies 📦
labels:
- dependencies
24 changes: 24 additions & 0 deletions .github/workflows/conform-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Conform Code

on:
pull_request:
paths:
- '**/*.lua'
branches:
- main

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
container:
image: ghcr.io/mistweaverco/kulala-nvim-testrunner:latest
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
name: Run linter
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: 0.20.0
args: --check .
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Release

on:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store

# neovim session management - https://github.com/mistweaverco/kikao.nvim
.nvim
21 changes: 17 additions & 4 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
globals = {
"vim",
stds.nvim = {
read_globals = { "jit" },
}

exclude_files = {
"lua/discord/deps",
std = "lua51+nvim"

read_globals = {
"vim",
}

globals = {
"vim.g",
"vim.b",
"vim.w",
"vim.o",
"vim.bo",
"vim.wo",
"vim.go",
"vim.env",
}
15 changes: 15 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"runtime.version": "LuaJIT",
"diagnostics.globals": [
"vim"
],
"runtime.settings.path": [
"?.lua",
"?/init.lua"
],
"workspace.checkThirdParty": false,
"workspace.library": [
"$VIMRUNTIME"
]
}
5 changes: 5 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
extends: default
rules:
truthy:
check-keys: false
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<div align="center">

![discord Logo](logo.svg)

# discord.nvim

A Discord <a href="https://discord.com/rich-presence">Rich Presence</a> plugin for <a href="https://neovim.io">Neovim</a>
![Lua](https://img.shields.io/badge/Made%20with%20Lua-blueviolet.svg?style=for-the-badge&logo=lua)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/mistweaverco/discord.nvim?style=for-the-badge)](https://github.com/mistweaverco/discord.nvim/releases/latest)

[Requirements](#requirements) • [Install](#install) • [Usage](#usage)

<p></p>

An unobtrusive Discord <a href="https://discord.com/rich-presence">Rich Presence</a> plugin that just works.

<p></p>

</div>

## Requirements

> [!WARNING]
> Requires [Neovim 0.10.1+](https://neovim.io) and [NodeJS 20](https://nodejs.org)

NodeJS is required due to the usage of
the [official SDK](https://discord.com/developers/docs/developer-tools/embedded-app-sdk)

## Features

Expand Down Expand Up @@ -31,13 +54,11 @@ use 'mistweaverco/discord.nvim'
Plug 'mistweaverco/discord.nvim'
```

#### Notes

- Requires [Neovim 0.5](https://github.com/neovim/neovim/releases/tag/v0.5.0) or higher

## Configuration

Configuration is not necessary for Rich Presence to work. But for those that want to override the default configs, the following options are available to configure in either Lua or VimL.
Configuration is not necessary for Rich Presence to work.
But for those that want to override the default configs,
the following options are available to configure Lua.

### Lua

Expand All @@ -50,14 +71,14 @@ require("discord").setup({
auto_connect = false, -- Automatically connect to Discord RPC
logo = "auto", -- "auto" or url
logo_tooltip = nil, -- nil or string
main_image = "language", -- "language" or "logo"
main_image = "language", -- "language" or "logo"
client_id = "1233867420330889286", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
global_timer = true, -- if set false, timer will be reset on aucmds
global_timer = true, -- if set false, timer will be reset on aucmds

-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
Expand All @@ -70,4 +91,3 @@ require("discord").setup({
terminal_text = "Using Terminal", -- Format string rendered when in terminal mode.
})
```

Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 128 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

check_code() {
if ! command -v stylua &> /dev/null; then
echo "stylua is not installed"
exit 1
fi
stylua --version
if [[ -n $1 ]]; then
stylua --check "$1"
else
stylua --check .
fi
}

check_docs() {
if ! command -v vale &> /dev/null; then
echo "stylua is not installed"
exit 1
fi
cd docs || exit 1
if [[ -n $1 ]]; then
vale "$1"
else
vale .
fi
}

main() {
local action="$1"
shift
local args=$*
case $action in
"check-code")
check_code "$args"
;;
"check-docs")
check_docs "$args"
;;
*)
echo "Invalid action"
exit 1
;;
esac

}
main "$@"