GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dprint/dprint-plugin-stylua: A plugin for dprint to format Lua and Luau files via StyLua

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
deployment
deployment
 
 
scripts
scripts
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.rustfmt.toml
.rustfmt.toml
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
deno.json
deno.json
 
 
deno.lock
deno.lock
 
 
dprint.json
dprint.json
 
 
rust-toolchain.toml
rust-toolchain.toml
 
 

Repository files navigation

dprint-plugin-stylua

npm version CI

Adapter for StyLua for use as a formatting plugin in dprint. It formats Lua and Luau files (.lua and .luau), including Lua 5.1 through 5.4, LuaJIT, and CfxLua.

Install

Install and setup dprint.

Then in your project's directory with a dprint.json file, run:

dprint add stylua

Note: You do not need StyLua installed globally as dprint will run StyLua from the .wasm file in a sandboxed environment.

Configuration

To add configuration, specify a "stylua" key in your dprint.json:

{
  "stylua": {
    "syntax": "luau",
    "lineWidth": 120,
    "useTabs": false,
    "indentWidth": 2,
    "quoteStyle": "autoPreferSingle",
    "callParentheses": "noSingleTable",
    "collapseSimpleStatement": "functionOnly",
    "sortRequires": true,
  },
  "plugins": [
    // ...etc...
  ],
}

The options and their defaults match StyLua's, with dprint's names for the common ones:

dprint StyLua Default
syntax syntax "all"
lineWidth column_width 120
useTabs indent_type (true is "Tabs") true
indentWidth indent_width 4
newLineKind line_endings "lf"
quoteStyle quote_style "autoPreferDouble"
callParentheses call_parentheses "always"
collapseSimpleStatement collapse_simple_statement "never"
blockNewlineGaps block_newline_gaps "never"
spaceAfterFunctionNames space_after_function_names "never"
sortRequires sort_requires.enabled false

Option values are camelCase versions of StyLua's (ex. "AutoPreferSingle" is "autoPreferSingle" and "LuaJIT" is "luajit"). Since the defaults are StyLua's, the global lineWidth, useTabs, indentWidth and newLineKind in your dprint.json are used when they're set and StyLua's defaults otherwise.

The plugin doesn't read stylua.toml, .stylua.toml or .editorconfig files, so move that configuration into dprint.json. -- stylua: ignore comments work as they do with StyLua, and range formatting is supported.

For an overview of the config, see https://github.com/dprint/dprint-plugin-stylua/blob/main/deployment/schema.json

JS Formatting API

  • JS Formatter - Browser/Deno and Node
  • npm package

Versioning

This repo automatically upgrades to the latest version of StyLua once a day. You can check which version of StyLua is being used by looking at the stylua entry in the Cargo.toml file in this repo:

https://github.com/dprint/dprint-plugin-stylua/blob/main/Cargo.toml

At the moment, the version of this plugin does not reflect the version of StyLua.

License

This project is licensed under the MIT License - see the LICENSE file for details. StyLua is licensed under the Mozilla Public License 2.0.

About

A plugin for dprint to format Lua and Luau files via StyLua

Resources

Readme
License
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.