repo
string | pull_number
int64 | instance_id
string | issue_numbers
sequence | base_commit
string | patch
string | test_patch
string | problem_statement
string | hints_text
string | created_at
string | version
string | updated_at
string | environment_setup_commit
string | FAIL_TO_PASS
sequence | PASS_TO_PASS
sequence | FAIL_TO_FAIL
sequence | PASS_TO_FAIL
sequence |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JohnnyMorganz/StyLua
| 469
|
JohnnyMorganz__StyLua-469
|
[
"448"
] |
56f144f15b2628282fb4a84344e8daad9b8d6666
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- `--output-format=json` now outputs all (error) messages in JSON format ([#453](https://github.com/JohnnyMorganz/StyLua/issues/453))
- Added WASM build support. Stylua is available on npm for consumption in Node.js or a browser (using a bundler) - https://www.npmjs.com/package/@johnnymorganz/stylua
+- Ignore comments will now be respected before fields inside tables ([#448](https://github.com/JohnnyMorganz/StyLua/issues/448))
### Fixed
- [**Luau**] Fixed spacing lost before a comment within a type generic ([#446](https://github.com/JohnnyMorganz/StyLua/issues/446))
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -108,9 +108,10 @@ AST, flagging any syntax errors or possible code semantics changes. This flag ma
where not every file can be examined for spurious formatting.
### Ignoring parts of a file
-If there is a specific statement within your file which you wish to skip formatting on, you can precede it with `-- stylua: ignore`,
-and it will be skipped over during formatting. This may be useful when there is a specific formatting style you wish to preserve for
-a statement. For example:
+
+To skip formatting a particular part of a file, you can add `-- stylua: ignore` before it.
+This may be useful if there is a particular style you want to preseve for readability, e.g.:
+
```lua
-- stylua: ignore
local matrix = {
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -119,7 +120,9 @@ local matrix = {
{ 0, 0, 0 },
}
```
-You can also disable formatting over a block of code by using `-- stylua: ignore start` / `-- stylua: ignore end` respectively.
+
+Formatting can also be skipped over a block of code using `-- stylua: ignore start` and `-- stylua: ignore end`:
+
```lua
local foo = true
-- stylua: ignore start
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -128,8 +131,8 @@ local baz = 0
-- stylua: ignore end
local foobar = false
```
-Note: this comment must be preceding a statement (same as `-- stylua: ignore`), and cannot cross block scope boundaries
-(i.e. if formatting is disabled, and we exit a block, formatting is automatically re-enabled).
+
+Note that ignoring cannot cross scope boundaries - once a block is exited, formatting will be re-enabled.
### Formatting Ranges
If you only want to format a specific range within a file, you can pass the `--range-start <num>` and/or `--range-end <num>` arguments,
diff --git a/src/context.rs b/src/context.rs
--- a/src/context.rs
+++ b/src/context.rs
@@ -106,33 +106,22 @@ impl Context {
}
if let Some(range) = self.range {
- let mut in_range = true;
-
- if let Some(start_bound) = range.start {
- if let Some(node_start) = node.start_position() {
- if node_start.bytes() < start_bound {
- in_range = false;
- }
+ match (range.start, node.start_position()) {
+ (Some(start_bound), Some(node_start)) if node_start.bytes() < start_bound => {
+ return FormatNode::NotInRange
}
- }
+ _ => (),
+ };
- if let Some(end_bound) = range.end {
- if let Some(node_end) = node.end_position() {
- if node_end.bytes() > end_bound {
- in_range = false;
- }
+ match (range.end, node.end_position()) {
+ (Some(end_bound), Some(node_end)) if node_end.bytes() > end_bound => {
+ return FormatNode::NotInRange
}
+ _ => (),
}
-
- if in_range {
- FormatNode::Normal
- } else {
- FormatNode::NotInRange
- }
- } else {
- // No range provided, therefore always in formatting range
- FormatNode::Normal
}
+
+ FormatNode::Normal
}
pub fn should_omit_string_parens(&self) -> bool {
diff --git a/src/formatters/table.rs b/src/formatters/table.rs
--- a/src/formatters/table.rs
+++ b/src/formatters/table.rs
@@ -1,5 +1,5 @@
use crate::{
- context::{create_indent_trivia, create_newline_trivia, Context},
+ context::{create_indent_trivia, create_newline_trivia, Context, FormatNode},
fmt_symbol,
formatters::{
expression::{format_expression, hang_expression, is_brackets_string},
diff --git a/src/formatters/table.rs b/src/formatters/table.rs
--- a/src/formatters/table.rs
+++ b/src/formatters/table.rs
@@ -110,6 +110,12 @@ fn format_field(
table_type: TableType,
shape: Shape,
) -> (Field, Vec<Token>) {
+ match dbg!(ctx.should_format_node(field)) {
+ FormatNode::Skip => return (field.to_owned(), Vec::new()),
+ FormatNode::NotInRange => unreachable!("called format_field on a field not in range"),
+ _ => (),
+ }
+
let leading_trivia = match table_type {
TableType::MultiLine => FormatTriviaType::Append(vec![create_indent_trivia(ctx, shape)]),
_ => FormatTriviaType::NoChange,
|
diff --git /dev/null b/tests/inputs-ignore/ignore-table-field.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/ignore-table-field.lua
@@ -0,0 +1,20 @@
+local foo = {
+ -- stylua: ignore
+ x = 2,
+ y = 3,
+ z = " he " ,
+}
+
+local bar = {
+ x = 2,
+ -- stylua: ignore
+ y = 3,
+ z = " he " ,
+}
+
+local baz = {
+ x = 2,
+ y = 3,
+ -- stylua: ignore
+ z = " he " ,
+}
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-1.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-1.lua
@@ -0,0 +1,5 @@
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+-- stylua: ignore end
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-2.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-2.lua
@@ -0,0 +1,6 @@
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+local bar = baz
+-- stylua: ignore end
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-multiple-comments-leading-trivia.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-multiple-comments-leading-trivia.lua
@@ -0,0 +1,17 @@
+--stylua: ignore start
+local a = 1
+--stylua: ignore end
+
+--stylua: ignore start
+local b = 2
+--stylua: ignore end
+
+--stylua: ignore start
+local c = 3
+--stylua: ignore end
+
+-- Some very large comment
+
+--stylua: ignore start
+local d = 4
+--stylua: ignore end
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-no-ending.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-no-ending.lua
@@ -0,0 +1,5 @@
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+local bar = baz
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-no-starting.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-no-starting.lua
@@ -0,0 +1,5 @@
+local foo = bar
+local bar = baz
+local bar = baz
+-- stylua: ignore end
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-scope-no-ending.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-scope-no-ending.lua
@@ -0,0 +1,7 @@
+local foo = bar
+do
+ -- stylua: ignore start
+ local bar = baz
+ local bar = baz
+end
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/multiline-block-ignore-scope.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/multiline-block-ignore-scope.lua
@@ -0,0 +1,8 @@
+local foo = bar
+do
+ -- stylua: ignore start
+ local bar = baz
+ -- stylua: ignore end
+ local bar = baz
+end
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/singleline-ignore-1.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/singleline-ignore-1.lua
@@ -0,0 +1,3 @@
+local foo = bar
+-- stylua: ignore
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/singleline-ignore-2.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/singleline-ignore-2.lua
@@ -0,0 +1,4 @@
+local foo = bar
+-- stylua: ignore
+local bar = baz
+local bar = baz
diff --git /dev/null b/tests/inputs-ignore/singleline-ignore-last-stmt.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/singleline-ignore-last-stmt.lua
@@ -0,0 +1,2 @@
+-- stylua: ignore
+return "hi"
diff --git /dev/null b/tests/inputs-ignore/singleline-ignore-stmt-block.lua
new file mode 100644
--- /dev/null
+++ b/tests/inputs-ignore/singleline-ignore-stmt-block.lua
@@ -0,0 +1,5 @@
+local x = 1
+-- stylua: ignore
+function foo ()
+ return x + 1
+end
diff --git /dev/null b/tests/snapshots/tests__ignores@ignore-table-field.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@ignore-table-field.lua.snap
@@ -0,0 +1,27 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = {
+ -- stylua: ignore
+ x = 2,
+ y = 3,
+ z = " he ",
+}
+
+local bar = {
+ x = 2,
+ -- stylua: ignore
+ y = 3,
+ z = " he ",
+}
+
+local baz = {
+ x = 2,
+ y = 3,
+ -- stylua: ignore
+ z = " he " ,
+}
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-1.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-1.lua.snap
@@ -0,0 +1,12 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+-- stylua: ignore end
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-2.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-2.lua.snap
@@ -0,0 +1,13 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+local bar = baz
+-- stylua: ignore end
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-multiple-comments-leading-trivia.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-multiple-comments-leading-trivia.lua.snap
@@ -0,0 +1,24 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+--stylua: ignore start
+local a = 1
+--stylua: ignore end
+
+--stylua: ignore start
+local b = 2
+--stylua: ignore end
+
+--stylua: ignore start
+local c = 3
+--stylua: ignore end
+
+-- Some very large comment
+
+--stylua: ignore start
+local d = 4
+--stylua: ignore end
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-no-ending.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-no-ending.lua.snap
@@ -0,0 +1,12 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+-- stylua: ignore start
+local bar = baz
+local bar = baz
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-no-starting.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-no-starting.lua.snap
@@ -0,0 +1,12 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+local bar = baz
+local bar = baz
+-- stylua: ignore end
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-scope-no-ending.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-scope-no-ending.lua.snap
@@ -0,0 +1,14 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+do
+ -- stylua: ignore start
+ local bar = baz
+ local bar = baz
+end
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@multiline-block-ignore-scope.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@multiline-block-ignore-scope.lua.snap
@@ -0,0 +1,15 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+do
+ -- stylua: ignore start
+ local bar = baz
+ -- stylua: ignore end
+ local bar = baz
+end
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@singleline-ignore-1.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@singleline-ignore-1.lua.snap
@@ -0,0 +1,10 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+-- stylua: ignore
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@singleline-ignore-2.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@singleline-ignore-2.lua.snap
@@ -0,0 +1,11 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local foo = bar
+-- stylua: ignore
+local bar = baz
+local bar = baz
+
diff --git /dev/null b/tests/snapshots/tests__ignores@singleline-ignore-last-stmt.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@singleline-ignore-last-stmt.lua.snap
@@ -0,0 +1,9 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+-- stylua: ignore
+return "hi"
+
diff --git /dev/null b/tests/snapshots/tests__ignores@singleline-ignore-stmt-block.lua.snap
new file mode 100644
--- /dev/null
+++ b/tests/snapshots/tests__ignores@singleline-ignore-stmt-block.lua.snap
@@ -0,0 +1,12 @@
+---
+source: tests/tests.rs
+assertion_line: 56
+expression: format(&contents)
+
+---
+local x = 1
+-- stylua: ignore
+function foo ()
+ return x + 1
+end
+
diff --git a/tests/test_ignore.rs /dev/null
--- a/tests/test_ignore.rs
+++ /dev/null
@@ -1,258 +0,0 @@
-use stylua_lib::{format_code, Config, OutputVerification};
-
-fn format(input: &str) -> String {
- format_code(input, Config::default(), None, OutputVerification::None).unwrap()
-}
-
-#[test]
-fn test_singleline_ignore() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
--- stylua: ignore
-local bar = baz
- "###
- ),
- @r###"
- local foo = bar
- -- stylua: ignore
- local bar = baz
- "###
- );
-}
-
-#[test]
-fn test_singleline_ignore_2() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
--- stylua: ignore
-local bar = baz
-local bar = baz
- "###
- ),
- @r###"
- local foo = bar
- -- stylua: ignore
- local bar = baz
- local bar = baz
- "###
- );
-}
-
-#[test]
-fn test_singleline_ignore_last_stmt() {
- insta::assert_snapshot!(
- format(
- r###"-- stylua: ignore
-return "hi"
- "###
- ),
- @r###"
- -- stylua: ignore
- return "hi"
- "###
- );
-}
-
-#[test]
-fn test_singleline_ignore_stmt_block() {
- insta::assert_snapshot!(
- r###"local x = 1
--- stylua: ignore
-function foo ()
- return x + 1
-end"###, @r###"
- local x = 1
- -- stylua: ignore
- function foo ()
- return x + 1
- end
- "###
- )
-}
-
-#[test]
-fn test_multiline_block_ignore() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
--- stylua: ignore start
-local bar = baz
--- stylua: ignore end
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- -- stylua: ignore start
- local bar = baz
- -- stylua: ignore end
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_2() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
--- stylua: ignore start
-local bar = baz
-local bar = baz
--- stylua: ignore end
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- -- stylua: ignore start
- local bar = baz
- local bar = baz
- -- stylua: ignore end
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_no_ending() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
--- stylua: ignore start
-local bar = baz
-local bar = baz
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- -- stylua: ignore start
- local bar = baz
- local bar = baz
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_no_starting() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
-local bar = baz
-local bar = baz
--- stylua: ignore end
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- local bar = baz
- local bar = baz
- -- stylua: ignore end
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_block_scope() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
-do
- -- stylua: ignore start
- local bar = baz
- -- stylua: ignore end
- local bar = baz
-end
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- do
- -- stylua: ignore start
- local bar = baz
- -- stylua: ignore end
- local bar = baz
- end
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_block_scope_no_ending() {
- insta::assert_snapshot!(
- format(
- r###"
-local foo = bar
-do
- -- stylua: ignore start
- local bar = baz
- local bar = baz
-end
-local bar = baz
-"###
- ),
- @r###"
- local foo = bar
- do
- -- stylua: ignore start
- local bar = baz
- local bar = baz
- end
- local bar = baz
- "###);
-}
-
-#[test]
-fn test_multiline_block_ignore_multiple_comments_in_leading_trivia() {
- insta::assert_snapshot!(
- format(
- r###"--stylua: ignore start
-local a = 1
---stylua: ignore end
-
---stylua: ignore start
-local b = 2
---stylua: ignore end
-
---stylua: ignore start
-local c = 3
---stylua: ignore end
-
--- Some very large comment
-
---stylua: ignore start
-local d = 4
---stylua: ignore end
-"###
- ),
- @r###"
- --stylua: ignore start
- local a = 1
- --stylua: ignore end
-
- --stylua: ignore start
- local b = 2
- --stylua: ignore end
-
- --stylua: ignore start
- local c = 3
- --stylua: ignore end
-
- -- Some very large comment
-
- --stylua: ignore start
- local d = 4
- --stylua: ignore end
- "###
- )
-}
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -1,6 +1,6 @@
use stylua_lib::{format_code, Config, OutputVerification, Range};
-fn format(input: &str, range: Range) -> String {
+fn format_range(input: &str, range: Range) -> String {
format_code(
input,
Config::default(),
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -10,15 +10,26 @@ fn format(input: &str, range: Range) -> String {
.unwrap()
}
+fn format(input: &str) -> String {
+ let start_point = input.find("||");
+ let end_point = input.rfind("||");
+
+ format_code(
+ &input.replace("||", ""),
+ Config::default(),
+ Some(Range::from_values(start_point, end_point)),
+ OutputVerification::None,
+ )
+ .unwrap()
+}
+
#[test]
fn test_default() {
insta::assert_snapshot!(
format(
- r###"
-local foo = bar
+ r###"||local foo = bar||
local bar = baz
"###,
- Range::from_values(Some(0), Some(30))
),
@r###"
local foo = bar
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -32,10 +43,9 @@ local bar = baz
fn test_ignore_last_stmt() {
insta::assert_snapshot!(
format(
- r###"function foo()
+ r###"||f||unction foo()
return bar
-end"###,
- Range::from_values(Some(0), Some(1))
+end"###
),
@r###"
function foo()
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -48,17 +58,16 @@ end"###,
fn test_dont_modify_eof() {
insta::assert_snapshot!(
format(
- r###"
-local foo = bar
+ r###"||local foo = bar||
local bar = baz
- "###,
- Range::from_values(Some(0), Some(30))
+ "###
),
@r###"
+
local foo = bar
local bar = baz
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -73,8 +82,7 @@ local bar = baz
fn test_incomplete_range() {
insta::assert_snapshot!(
format(
- r###"local fooo = bar"###,
- Range::from_values(Some(0), Some(5))
+ r###"||local|| fooo = bar"###
),
@r###"
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -87,8 +95,7 @@ fn test_incomplete_range() {
fn test_large_example() {
insta::assert_snapshot!(
format(
- r###"
-if string.sub(msg, 1, 8) == "setgrav/" then
+ r###"||if string.sub(msg, 1, 8) == "setgrav/" then
danumber = nil for i = 9, 100 do if string.sub(msg, i, i) == "/" then danumber = i break end end if danumber == nil then
return end local player = findplayer(string.sub(msg, 9, danumber - 1), speaker)
if player == 0 then return end for i = 1, #player do if player[i].Character ~= nil then
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -101,7 +108,7 @@ bf.Parent = torso end local c2 = player[i].Character:GetChildren()
for i = 1, #c2 do if c2[i].className == "Part" then
torso.BF.force = torso.BF.force
+ Vector3.new(0, c2[i]:getMass() * -string.sub(msg, danumber + 1), 0)
-end end end end end end
+end end end end end end||
if string.sub(msg, 1, 5) == "trip/" then local player = findplayer(string.sub(msg, 6), speaker)
if player ~= 0 then for i = 1, #player do
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -109,10 +116,10 @@ if player[i].Character ~= nil then
local torso = player[i].Character:FindFirstChild("Torso")
if torso ~= nil then torso.CFrame = CFrame.new(torso.Position.x, torso.Position.y, torso.Position.z, 0, 0, 1, 0, -1, 0, 1, 0, 0) --math.random(),math.random(),math.random(),math.random(),math.random(),math.random(),math.random(),math.random(),math.random()) -- i like the people being upside down better.
end end end end end
- "###,
- Range::from_values(Some(0), Some(847))
+ "###
),
@r###"
+
if string.sub(msg, 1, 8) == "setgrav/" then
danumber = nil
for i = 9, 100 do
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -168,10 +175,9 @@ fn test_nested_range() {
insta::assert_snapshot!(
format(
r###"local my_function = function()
- local nested_statement = "foobar"
+ ||local nested_statement = "foobar"||
end
-"###,
- Range::from_values(Some(33), Some(76))
+"###
),
@r###"
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -187,11 +193,10 @@ fn test_nested_range_local_function() {
format(
r###"local function test()
call "hello"
- call { x = y}
- local z = 1 + 3 - (2 / 3)
+ ||call { x = y}
+ local z = 1 + 3 - (2 / 3)||
end
-"###,
- Range::from_values(Some(33), Some(116))
+"###
),
@r###"
local function test()
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -207,10 +212,9 @@ fn test_nested_range_while() {
insta::assert_snapshot!(
format(
r###"while true do
- local z = 2
+ ||local z = 2||
end
-"###,
- Range::from_values(Some(21), Some(47))
+"###
),
@r###"
while true do
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -223,11 +227,10 @@ fn test_nested_range_while() {
fn test_nested_range_repeat() {
insta::assert_snapshot!(
format(
- r###"repeat
- local z = 2
+ r###"repeat||
+ local z = 2||
until true
-"###,
- Range::from_values(Some(6), Some(32))
+"###
),
@r###"
repeat
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -241,10 +244,9 @@ fn test_nested_range_do() {
insta::assert_snapshot!(
format(
r###"do
- local z = 2
+ ||local z = 2||
end
-"###,
- Range::from_values(Some(2), Some(32))
+"###
),
@r###"
do
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -258,10 +260,9 @@ fn test_nested_range_generic_for() {
insta::assert_snapshot!(
format(
r###"for i, v in pairs(x) do
- local z = 2
+ ||local z = 2||
end
-"###,
- Range::from_values(Some(30), Some(56))
+"###
),
@r###"
for i, v in pairs(x) do
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -277,10 +278,9 @@ fn test_nested_range_else_if() {
r###"if x and y then
local p = q
elseif c - d > 2 then
- local z = 2
+ ||local z = 2||
end
-"###,
- Range::from_values(Some(69), Some(95))
+"###
),
@r###"
if x and y then
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -296,10 +296,9 @@ fn test_nested_range_function_call() {
insta::assert_snapshot!(
format(
r###"call (function ()
- local z = 5
+ ||local z = 5||
end)
-"###,
- Range::from_values(Some(22), Some(58))
+"###
),
@r###"
call (function ()
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -313,10 +312,9 @@ fn test_nested_range_function_call_table() {
insta::assert_snapshot!(
format(
r###"call { x = function()
- local z = 2
+ ||local z = 2||
end}
-"###,
- Range::from_values(Some(28), Some(61))
+"###
),
@r###"
call { x = function()
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -331,11 +329,10 @@ fn test_nested_range_table_1() {
format(
r###"local z = {
function()
- local z = 5
+ ||local z = 5||
end
}
-"###,
- Range::from_values(Some(50), Some(121))
+"###
),
@r###"
local z = {
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -352,12 +349,11 @@ fn test_nested_range_table_2() {
format(
r###"local z = {
[(function()
- return random_func ()
+ ||return random_func ()||
end)()] = true
}
-"###,
- Range::from_values(Some(41), Some(121))
+"###
),
@r###"
local z = {
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -374,10 +370,9 @@ fn test_nested_range_binop() {
insta::assert_snapshot!(
format(
r###"local z =( 1 + (function()
- local p = q
+ ||local p = q||
end)())
-"###,
- Range::from_values(Some(40), Some(75))
+"###
),
@r###"
local z =( 1 + (function()
diff --git a/tests/test_ranges.rs b/tests/test_ranges.rs
--- a/tests/test_ranges.rs
+++ b/tests/test_ranges.rs
@@ -385,3 +380,34 @@ fn test_nested_range_binop() {
end)())
"###);
}
+
+#[test]
+fn test_no_range_start() {
+ insta::assert_snapshot!(
+ format_range(
+ r###"local z = 2
+local e = 5
+"###,
+ Range::from_values(None, Some(20))
+ ),
+ @r###"
+ local z = 2
+ local e = 5
+ "###);
+}
+
+#[test]
+fn test_no_range_end() {
+ insta::assert_snapshot!(
+ format_range(
+ r###"local z = 2
+local e = 5
+"###,
+ Range::from_values(Some(20), None)
+ ),
+ @r###"
+
+ local z = 2
+ local e = 5
+ "###);
+}
diff --git a/tests/tests.rs b/tests/tests.rs
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -48,3 +48,11 @@ fn test_lua52() {
insta::assert_snapshot!(format(&contents));
})
}
+
+#[test]
+fn test_ignores() {
+ insta::glob!("inputs-ignore/*.lua", |path| {
+ let contents = std::fs::read_to_string(path).unwrap();
+ insta::assert_snapshot!(format(&contents));
+ })
+}
|
Allow ignore comments to be used in places other than before statements
Currently, the only place ignore comments will be registered if they are leading trivia before statements.
This can be confusing, especially when you place a comment somewhere but it does not do anything.
We should be able to handle ignore comments in most locations. A key location to start with is before a field within a table (we may want to specifically ignore a single field). The only thing to consider is the impact that ignoring has on the remaining formatted code.
|
2022-06-25T19:22:24Z
|
0.13
|
2022-06-25T12:18:38Z
|
69c9278e551be7681578e01e6ab16cf6b05c82c5
|
[
"test_ignores"
] |
[
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"tests::test_config_call_parentheses",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"tests::test_config_indent_type",
"tests::test_config_column_width",
"tests::test_config_indent_width",
"tests::test_config_quote_style",
"tests::test_config_line_endings",
"tests::test_invalid_input",
"verify_ast::tests::test_equivalent_asts",
"verify_ast::tests::test_different_asts",
"verify_ast::tests::test_different_binary_numbers",
"verify_ast::tests::test_equivalent_binary_numbers",
"verify_ast::tests::test_different_hex_numbers",
"tests::test_entry_point",
"verify_ast::tests::test_equivalent_conditions",
"verify_ast::tests::test_equivalent_hex_numbers",
"tests::test_with_ast_verification",
"verify_ast::tests::test_equivalent_string_escapes",
"verify_ast::tests::test_equivalent_string_quote_types",
"verify_ast::tests::test_equivalent_function_calls",
"verify_ast::tests::test_equivalent_numbers",
"verify_ast::tests::test_equivalent_stmt_semicolons",
"verify_ast::tests::test_equivalent_numbers_2",
"verify_ast::tests::test_equivalent_function_calls_2",
"verify_ast::tests::test_equivalent_table_separators",
"output_diff::tests::test_addition_diff",
"output_diff::tests::test_no_diff",
"output_diff::tests::test_deletion_diff",
"output_diff::tests::test_change_diff",
"opt::tests::verify_opt",
"config::tests::test_override_indent_width",
"config::tests::test_override_column_width",
"config::tests::test_override_line_endings",
"config::tests::test_override_quote_style",
"config::tests::test_override_call_parentheses",
"config::tests::test_override_indent_type",
"tests::test_no_files_provided",
"tests::test_format_stdin",
"test_call_parens_comments",
"test_call_parens_semicolons",
"test_call_parens_none_handles_string_correctly",
"test_call_parens_no_single_string_handles_string_correctly",
"test_call_parens_none_handles_table_correctly",
"test_call_parens_always_handles_string_correctly",
"test_call_parens_no_single_table_handles_table_correctly",
"test_call_parens_no_single_string_handles_table_correctly",
"test_call_parens_always_handles_table_correctly",
"test_call_parens_no_single_table_handles_string_correctly",
"test_call_parens_has_no_affect_on_multi_arg_fn_calls_",
"test_omit_parens_brackets_string",
"test_no_parens_brackets_string",
"test_no_parens_singleline_table",
"test_no_parens_multiline_table",
"test_no_parens_string",
"test_omit_parens_string",
"test_no_parens_method_chain_2",
"test_keep_parens_binop_string",
"test_no_parens_method_chain_1",
"test_no_parens_large_example",
"test_force_single_quotes",
"test_force_double_quotes",
"test_auto_prefer_single_quotes",
"test_auto_prefer_double_quotes",
"test_nested_range_function_call",
"test_incomplete_range",
"test_nested_range_do",
"test_ignore_last_stmt",
"test_nested_range_else_if",
"test_dont_modify_eof",
"test_nested_range_function_call_table",
"test_nested_range_generic_for",
"test_nested_range",
"test_default",
"test_nested_range_binop",
"test_nested_range_repeat",
"test_no_range_end",
"test_no_range_start",
"test_nested_range_while",
"test_nested_range_table_1",
"test_nested_range_table_2",
"test_nested_range_local_function",
"test_large_example",
"test_lua52",
"test_luau_full_moon",
"test_luau"
] |
[] |
[] |
|
JohnnyMorganz/StyLua
| 422
|
JohnnyMorganz__StyLua-422
|
[
"421"
] |
30c713bc68d31b45fcfba1227bc6fbd4df97cba2
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed issue through static linking where Windows binary would not execute due to missing `VCRUNTIME140.dll`. ([#413](https://github.com/JohnnyMorganz/StyLua/issues/413))
- Fixed assignment with comment sometimes not hanging leading to malformed syntax. ([#416](https://github.com/JohnnyMorganz/StyLua/issues/416))
+- Fixed block ignores not applied when multiple leading block ignore comments are present at once. ([#421](https://github.com/JohnnyMorganz/StyLua/issues/421))
## [0.12.5] - 2022-03-08
### Fixed
diff --git a/src/context.rs b/src/context.rs
--- a/src/context.rs
+++ b/src/context.rs
@@ -44,33 +44,36 @@ impl Context {
// To preserve immutability of Context, we return a new Context with the `formatting_disabled` field toggled or left the same
// where necessary. Context is cheap so this is reasonable to do.
pub fn check_toggle_formatting(&self, node: &impl Node) -> Self {
- // Check comments
+ // Load all the leading comments from the token
let leading_trivia = node.surrounding_trivia().0;
- for trivia in leading_trivia {
- let comment_lines = match trivia.token_type() {
- TokenType::SingleLineComment { comment } => comment,
- TokenType::MultiLineComment { comment, .. } => comment,
- _ => continue,
- }
- .lines()
- .map(|line| line.trim());
-
- for line in comment_lines {
- if line == "stylua: ignore start" && !self.formatting_disabled {
- return Self {
- formatting_disabled: true,
- ..*self
- };
- } else if line == "stylua: ignore end" && self.formatting_disabled {
- return Self {
- formatting_disabled: false,
- ..*self
- };
+ let comment_lines = leading_trivia
+ .iter()
+ .filter_map(|trivia| {
+ match trivia.token_type() {
+ TokenType::SingleLineComment { comment } => Some(comment),
+ TokenType::MultiLineComment { comment, .. } => Some(comment),
+ _ => None,
}
+ .map(|comment| comment.lines().map(|line| line.trim()))
+ })
+ .flatten();
+
+ // Load the current formatting disabled state
+ let mut formatting_disabled = self.formatting_disabled;
+
+ // Work through all the lines and update the state as necessary
+ for line in comment_lines {
+ if line == "stylua: ignore start" {
+ formatting_disabled = true;
+ } else if line == "stylua: ignore end" {
+ formatting_disabled = false;
}
}
- *self
+ Self {
+ formatting_disabled,
+ ..*self
+ }
}
/// Checks whether we should format the given node.
|
diff --git a/tests/test_ignore.rs b/tests/test_ignore.rs
--- a/tests/test_ignore.rs
+++ b/tests/test_ignore.rs
@@ -211,3 +211,48 @@ local bar = baz
local bar = baz
"###);
}
+
+#[test]
+fn test_multiline_block_ignore_multiple_comments_in_leading_trivia() {
+ insta::assert_snapshot!(
+ format(
+ r###"--stylua: ignore start
+local a = 1
+--stylua: ignore end
+
+--stylua: ignore start
+local b = 2
+--stylua: ignore end
+
+--stylua: ignore start
+local c = 3
+--stylua: ignore end
+
+-- Some very large comment
+
+--stylua: ignore start
+local d = 4
+--stylua: ignore end
+"###
+ ),
+ @r###"
+ --stylua: ignore start
+ local a = 1
+ --stylua: ignore end
+
+ --stylua: ignore start
+ local b = 2
+ --stylua: ignore end
+
+ --stylua: ignore start
+ local c = 3
+ --stylua: ignore end
+
+ -- Some very large comment
+
+ --stylua: ignore start
+ local d = 4
+ --stylua: ignore end
+ "###
+ )
+}
|
Block ignore is not applied to all back-to-back blocks
When `--stylua: ignore start/end` comments are applied back-to-back, they take effect on every second ignored block. This might be considered as a non-issue because they can be merged into one single ignored block, but it might be inconvenient when they are separated with large comment block.
My understanding is that "this comment must be preceding a statement (same as `-- stylua: ignore`), and cannot cross block scope boundaries" holds here, although I am not sure about it.
Steps to reproduce:
- Create file `tmp.lua` with the following contents:
```lua
--stylua: ignore start
local a = 1
--stylua: ignore end
--stylua: ignore start
local b = 2
--stylua: ignore end
--stylua: ignore start
local c = 3
--stylua: ignore end
-- Some very large comment
--stylua: ignore start
local d = 4
--stylua: ignore end
```
- Run `stylua tmp.lua`.
Currently observed output:
```lua
--stylua: ignore start
local a = 1
--stylua: ignore end
--stylua: ignore start
local b = 2
--stylua: ignore end
--stylua: ignore start
local c = 3
--stylua: ignore end
-- Some very large comment
--stylua: ignore start
local d = 4
--stylua: ignore end
```
Details:
- Version of StyLua: 0.12.5
- OS: Xubuntu 20.04.
|
Yeah, this is a bug - it seems as though we are not correctly re-opening an ignore section when we see the `--stylua: ignore start` comment.
This code is actually parsed as these separate statements:
```lua
--stylua: ignore start
local a = 1
---------------------------
--stylua: ignore end
--stylua: ignore start
local b = 2
```
where `--stylua: ignore end` and `--stylua: ignore start` are both leading trivia of the `local b` statement.
We are probably exiting early when we see the `--stylua: ignore end` comment in the leading trivia, but we should continue scanning in case we find another ignore comment afterwards
|
2022-03-27T21:08:32Z
|
0.12
|
2022-03-27T13:12:43Z
|
a369d02342f3b1432ff89c619c97129a57678141
|
[
"test_multiline_block_ignore_multiple_comments_in_leading_trivia"
] |
[
"formatters::trivia_util::tests::test_token_contains_singleline_comments",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2",
"formatters::trivia_util::tests::test_token_contains_no_singleline_comments",
"tests::test_config_call_parentheses",
"tests::test_config_column_width",
"tests::test_config_indent_type",
"tests::test_config_indent_width",
"tests::test_config_quote_style",
"tests::test_config_line_endings",
"tests::test_invalid_input",
"verify_ast::tests::test_different_binary_numbers",
"verify_ast::tests::test_equivalent_binary_numbers",
"verify_ast::tests::test_different_asts",
"verify_ast::tests::test_different_hex_numbers",
"verify_ast::tests::test_equivalent_asts",
"tests::test_with_ast_verification",
"verify_ast::tests::test_equivalent_hex_numbers",
"tests::test_entry_point",
"verify_ast::tests::test_equivalent_function_calls",
"verify_ast::tests::test_equivalent_conditions",
"verify_ast::tests::test_equivalent_numbers",
"verify_ast::tests::test_equivalent_stmt_semicolons",
"verify_ast::tests::test_equivalent_numbers_2",
"verify_ast::tests::test_equivalent_string_escapes",
"verify_ast::tests::test_equivalent_function_calls_2",
"verify_ast::tests::test_equivalent_string_quote_types",
"verify_ast::tests::test_equivalent_table_separators",
"output_diff::tests::test_no_diff",
"output_diff::tests::test_addition_diff",
"output_diff::tests::test_deletion_diff",
"output_diff::tests::test_change_diff",
"opt::tests::verify_opt",
"config::tests::test_override_column_width",
"config::tests::test_override_line_endings",
"config::tests::test_override_indent_type",
"config::tests::test_override_quote_style",
"config::tests::test_override_indent_width",
"config::tests::test_override_call_parentheses",
"tests::test_no_files_provided",
"tests::test_format_stdin",
"test_call_parens_comments",
"test_call_parens_semicolons",
"test_call_parens_no_single_string_handles_string_correctly",
"test_call_parens_none_handles_string_correctly",
"test_call_parens_no_single_table_handles_string_correctly",
"test_call_parens_always_handles_string_correctly",
"test_call_parens_none_handles_table_correctly",
"test_call_parens_no_single_table_handles_table_correctly",
"test_call_parens_always_handles_table_correctly",
"test_call_parens_no_single_string_handles_table_correctly",
"test_call_parens_has_no_affect_on_multi_arg_fn_calls_",
"test_singleline_ignore_stmt_block",
"test_singleline_ignore",
"test_singleline_ignore_last_stmt",
"test_multiline_block_ignore_block_scope_no_ending",
"test_multiline_block_ignore",
"test_multiline_block_ignore_2",
"test_singleline_ignore_2",
"test_multiline_block_ignore_block_scope",
"test_multiline_block_ignore_no_ending",
"test_multiline_block_ignore_no_starting",
"test_no_parens_brackets_string",
"test_omit_parens_brackets_string",
"test_no_parens_singleline_table",
"test_no_parens_string",
"test_no_parens_multiline_table",
"test_omit_parens_string",
"test_keep_parens_binop_string",
"test_no_parens_method_chain_1",
"test_no_parens_method_chain_2",
"test_no_parens_large_example",
"test_force_single_quotes",
"test_auto_prefer_double_quotes",
"test_auto_prefer_single_quotes",
"test_force_double_quotes",
"test_ignore_last_stmt",
"test_nested_range_do",
"test_dont_modify_eof",
"test_default",
"test_nested_range_else_if",
"test_nested_range_generic_for",
"test_nested_range_function_call",
"test_nested_range_binop",
"test_incomplete_range",
"test_nested_range",
"test_nested_range_function_call_table",
"test_nested_range_repeat",
"test_nested_range_while",
"test_nested_range_local_function",
"test_nested_range_table_1",
"test_nested_range_table_2",
"test_large_example",
"test_lua52",
"test_luau_full_moon",
"test_luau"
] |
[] |
[] |
JohnnyMorganz/StyLua
| 131
|
JohnnyMorganz__StyLua-131
|
[
"78"
] |
aa9d9319d0314a853c4f56d3c120525668dc1a8a
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -7,10 +7,14 @@(...TRUNCATED)
| "diff --git /dev/null b/src/shape.rs\nnew file mode 100644\n--- /dev/null\n+++ b/src/shape.rs\n@@ -0(...TRUNCATED)
| "Turns readable multi-line function calls into harder to read, single line ones, but are under the c(...TRUNCATED)
| "I definitely also prefer the former styling here, so this should be looked into.\n\nI think part of(...TRUNCATED)
|
2021-04-30T00:06:22Z
|
0.7
|
2021-04-30T12:15:38Z
|
aa9d9319d0314a853c4f56d3c120525668dc1a8a
|
[
"test_luau"
] |
[
"test_lua52"
] |
[] |
[] |
JohnnyMorganz/StyLua
| 931
|
JohnnyMorganz__StyLua-931
|
[
"928"
] |
d67c77b6f73ccab63d544adffe9cf3d859e71fa4
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -7,6 +7,10 @@ (...TRUNCATED)
| "diff --git a/src/cli/main.rs b/src/cli/main.rs\n--- a/src/cli/main.rs\n+++ b/src/cli/main.rs\n@@ -8(...TRUNCATED)
| "after new release stdin does not repsect .stylua.toml by default\nunless must set config-path .. be(...TRUNCATED)
| "Looks like a mistake in https://github.com/JohnnyMorganz/StyLua/blob/1daf4c18fb6baf687cc41082f1cc69(...TRUNCATED)
|
2024-11-30T20:21:18Z
|
2.0
|
2024-11-30T12:36:13Z
|
f581279895a7040a36abaea4a6c8a6f50f112cd7
|
[
"tests::test_cwd_configuration_respected_when_formatting_from_stdin"
] | ["editorconfig::tests::test_collapse_simple_statement_always","editorconfig::tests::test_call_parent(...TRUNCATED)
|
[] |
[] |
JohnnyMorganz/StyLua
| 926
|
JohnnyMorganz__StyLua-926
|
[
"925"
] |
08e536f3a02d9a07b0991726897e0013ff78dd21
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -7,6 +7,10 @@ (...TRUNCATED)
| "diff --git a/src/cli/main.rs b/src/cli/main.rs\n--- a/src/cli/main.rs\n+++ b/src/cli/main.rs\n@@ -9(...TRUNCATED)
| "CLI overrides not applied when formatting files in v2.0.0\nI tried to run it both from Windows and (...TRUNCATED)
| "Hm, this does look like line endings changing for some reason. Which is weird, since I don't think (...TRUNCATED)
|
2024-11-18T05:01:53Z
|
2.0
|
2024-11-17T21:06:05Z
|
f581279895a7040a36abaea4a6c8a6f50f112cd7
|
[
"tests::test_uses_cli_overrides_instead_of_found_configuration"
] | ["editorconfig::tests::test_call_parentheses_no_single_string","editorconfig::tests::test_call_paren(...TRUNCATED)
|
[] |
[] |
JohnnyMorganz/StyLua
| 916
|
JohnnyMorganz__StyLua-916
|
[
"831",
"915"
] |
d7d532b4baf2bcf2adf1925d7248f659788e5b58
| "diff --git a/README.md b/README.md\n--- a/README.md\n+++ b/README.md\n@@ -229,7 +229,8 @@ StyLua ha(...TRUNCATED)
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -21,6 +21,9 @@(...TRUNCATED)
| "feat: Use closest `stylua.toml` config to file being formatted\nIt would be nice if the formatter c(...TRUNCATED)
| "> we stop at first .stylelua file, somehow it does not stop and merges\r\n\r\nthis sounds incorrec(...TRUNCATED)
|
2024-11-17T19:57:54Z
|
0.20
|
2024-11-17T16:13:53Z
|
26047670e05ba310afe9c1c1f91be6749e1f3ac9
| ["tests::test_configuration_is_used_closest_to_the_file","tests::test_configuration_is_searched_next(...TRUNCATED)
| ["editorconfig::tests::test_call_parentheses_no_single_table","editorconfig::tests::test_call_parent(...TRUNCATED)
|
[] |
[] |
JohnnyMorganz/StyLua
| 852
|
JohnnyMorganz__StyLua-852
|
[
"845"
] |
bc3ce881eaaee46e8eb851366d33cba808d2a1f7
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -23,6 +23,7 @@(...TRUNCATED)
| "diff --git a/src/cli/main.rs b/src/cli/main.rs\n--- a/src/cli/main.rs\n+++ b/src/cli/main.rs\n@@ -7(...TRUNCATED)
| "`--respect-ignores`: does not correctly ignore folders without the globbing pattern \nProblem: `.st(...TRUNCATED)
| "We use the ignore crate to provide gitignore-style ignores: https://docs.rs/ignore/latest/ignore/. (...TRUNCATED)
|
2024-01-20T20:13:59Z
|
0.19
|
2024-01-20T12:37:21Z
|
bc3ce881eaaee46e8eb851366d33cba808d2a1f7
|
[
"tests::test_respect_ignores_directory_no_glob"
] | ["editorconfig::tests::test_call_parentheses_always","editorconfig::tests::test_call_parentheses_no_(...TRUNCATED)
|
[] |
[] |
JohnnyMorganz/StyLua
| 752
|
JohnnyMorganz__StyLua-752
|
[
"750"
] |
fdf9f0c5952cb1565ba6449929514eb94ac5ef3f
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -7,6 +7,10 @@ (...TRUNCATED)
| "diff --git a/src/verify_ast.rs b/src/verify_ast.rs\n--- a/src/verify_ast.rs\n+++ b/src/verify_ast.r(...TRUNCATED)
| "Panic when format luajit type with `--verify` flag\ninstalled by `cargo install stylua --features l(...TRUNCATED)
|
2023-09-02T08:18:04Z
|
0.18
|
2023-09-02T00:44:03Z
|
095e2b0c79df0bac21915dd2deee9a0a25a9b382
| ["verify_ast::tests::test_equivalent_luajit_numbers","test_global","test_local","test_empty_root","t(...TRUNCATED)
| ["editorconfig::tests::test_call_parentheses_always","editorconfig::tests::test_call_parentheses_no_(...TRUNCATED)
|
[] |
[] |
|
JohnnyMorganz/StyLua
| 666
|
JohnnyMorganz__StyLua-666
|
[
"665"
] |
46457ad4e4130d07ee0f9a5cf95ac10023c8ceeb
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -11,6 +11,7 @@(...TRUNCATED)
| "diff --git a/tests/tests.rs b/tests/tests.rs\n--- a/tests/tests.rs\n+++ b/tests/tests.rs\n@@ -127,3(...TRUNCATED)
| "Line endings appear to not be converted when they occur in multiline comments (?)\nHeyo, we've run (...TRUNCATED)
|
Definitely unintended, let me take a look. Thanks for the report!
|
2023-03-30T23:38:41Z
|
0.17
|
2023-03-30T15:47:25Z
|
5c6d59135f419274121349799a5227be467358b1
| ["test_global","test_root","test_local","test_stylua_toml","test_crlf_in_multiline_strings","test_cr(...TRUNCATED)
| ["editorconfig::tests::test_call_parentheses_always","editorconfig::tests::test_call_parentheses_no_(...TRUNCATED)
|
[] |
[] |
JohnnyMorganz/StyLua
| 645
|
JohnnyMorganz__StyLua-645
|
[
"75"
] |
15c1f0d4880dbcfe37dd2828da10745f95a13825
| "diff --git a/CHANGELOG.md b/CHANGELOG.md\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -22,6 +22,10 @(...TRUNCATED)
| "diff --git a/.gitattributes b/.gitattributes\n--- a/.gitattributes\n+++ b/.gitattributes\n@@ -1,3 +(...TRUNCATED)
| "[Suggestion] Support .editorconfig\nGiven that [.editorconfig file](https://editorconfig.org/) prov(...TRUNCATED)
| "I believe the way prettier does this is to allow an option to defer to the `.editorconfig` file. Wo(...TRUNCATED)
|
2023-02-04T22:22:18Z
|
0.16
|
2023-11-20T17:38:32Z
|
12d3f3d31b203d90d615183d6ac356b3cb71b913
|
[
"test_lua54"
] | ["formatters::trivia_util::tests::test_token_contains_no_singleline_comments","formatters::trivia_ut(...TRUNCATED)
|
[] |
[] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 1