Skip to content

Commit 1eab8bf

Browse files
committed
Merge remote-tracking branch 'CppCXY/main' into dev
2 parents f05f62a + d77c5e5 commit 1eab8bf

File tree

42 files changed

+197
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+197
-127
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@ on:
99
branches:
1010
- main
1111

12+
env:
13+
RUST_BACKTRACE: 1
14+
CARGO_TERM_COLOR: always
15+
CLICOLOR: 1
16+
1217
jobs:
18+
spelling:
19+
name: Spell Check with Typos
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Spell Check Repo
25+
uses: crate-ci/typos@master
26+
1327
test:
1428
runs-on: ubuntu-latest
1529
steps:

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
`FIX` Fix possible panic due to integer overflow when calculating pows.
5050

51-
`NEW` Support compile by winodws mingw
51+
`NEW` Support compile by windows mingw
5252

5353
`NEW` `emmylua_check` now supports `workspace.library`
5454

crates/emmylua_check/src/output/json_output_writter.rs renamed to crates/emmylua_check/src/output/json_output_writer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ use serde_json::{json, Value};
66

77
use crate::cmd_args::OutputDestination;
88

9-
use super::OutputWritter;
9+
use super::OutputWriter;
1010

1111
#[derive(Debug)]
12-
pub struct JsonOutputWritter {
12+
pub struct JsonOutputWriter {
1313
output: Option<File>,
1414
first_write: bool,
1515
json_file_caches: Vec<Value>,
1616
}
1717

18-
impl JsonOutputWritter {
18+
impl JsonOutputWriter {
1919
pub fn new(output: OutputDestination) -> Self {
2020
let output = match output {
2121
OutputDestination::Stdout => None,
@@ -29,15 +29,15 @@ impl JsonOutputWritter {
2929
Some(std::fs::File::create(path).unwrap())
3030
}
3131
};
32-
JsonOutputWritter {
32+
JsonOutputWriter {
3333
output,
3434
first_write: true,
3535
json_file_caches: Vec::new(),
3636
}
3737
}
3838
}
3939

40-
impl OutputWritter for JsonOutputWritter {
40+
impl OutputWriter for JsonOutputWriter {
4141
fn write(&mut self, db: &DbIndex, file_id: FileId, diagnostics: Vec<Diagnostic>) {
4242
let file_path = db.get_vfs().get_file_path(&file_id).unwrap();
4343
let file_path = file_path.to_str().unwrap();

crates/emmylua_check/src/output/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mod json_output_writter;
2-
mod text_output_writter;
1+
mod json_output_writer;
2+
mod text_output_writer;
33

44
use std::path::PathBuf;
55

@@ -18,9 +18,9 @@ pub async fn output_result(
1818
output: OutputDestination,
1919
warnings_as_errors: bool,
2020
) -> i32 {
21-
let mut writter: Box<dyn OutputWritter> = match output_format {
22-
OutputFormat::Json => Box::new(json_output_writter::JsonOutputWritter::new(output)),
23-
OutputFormat::Text => Box::new(text_output_writter::TextOutputWritter::new(workspace)),
21+
let mut writer: Box<dyn OutputWriter> = match output_format {
22+
OutputFormat::Json => Box::new(json_output_writer::JsonOutputWriter::new(output)),
23+
OutputFormat::Text => Box::new(text_output_writer::TextOutputWriter::new(workspace)),
2424
};
2525

2626
let mut has_error = false;
@@ -39,15 +39,15 @@ pub async fn output_result(
3939
break;
4040
}
4141
}
42-
writter.write(db, file_id, diagnostics);
42+
writer.write(db, file_id, diagnostics);
4343
}
4444

4545
if count == total_count {
4646
break;
4747
}
4848
}
4949

50-
writter.finish();
50+
writer.finish();
5151

5252
if has_error {
5353
1
@@ -56,7 +56,7 @@ pub async fn output_result(
5656
}
5757
}
5858

59-
trait OutputWritter {
59+
trait OutputWriter {
6060
fn write(&mut self, db: &DbIndex, file_id: FileId, diagnostics: Vec<Diagnostic>);
6161

6262
fn finish(&mut self);

crates/emmylua_check/src/output/text_output_writter.rs renamed to crates/emmylua_check/src/output/text_output_writer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ use std::path::PathBuf;
33
use emmylua_code_analysis::{DbIndex, FileId};
44
use lsp_types::Diagnostic;
55

6-
use super::OutputWritter;
6+
use super::OutputWriter;
77
use ariadne::{Color, Label, Report, ReportKind, Source};
88

99
#[derive(Debug)]
10-
pub struct TextOutputWritter {
10+
pub struct TextOutputWriter {
1111
workspace: PathBuf,
1212
}
1313

14-
impl TextOutputWritter {
14+
impl TextOutputWriter {
1515
pub fn new(workspace: PathBuf) -> Self {
16-
TextOutputWritter { workspace }
16+
TextOutputWriter { workspace }
1717
}
1818
}
1919

20-
impl OutputWritter for TextOutputWritter {
20+
impl OutputWriter for TextOutputWriter {
2121
fn write(&mut self, db: &DbIndex, file_id: FileId, diagnostics: Vec<Diagnostic>) {
2222
if diagnostics.is_empty() {
2323
return;

crates/emmylua_code_analysis/locales/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The property is protected and cannot be accessed outside its subclasses.:
3434
zh_CN: '该属性受保护,无法在其子类之外访问。'
3535
zh_HK: '該屬性受保護,無法在其子類之外訪問。'
3636
zh_TW: '該屬性受保護,無法在其子類之外訪問。'
37-
expected %{num} but founded %{found_num}. %{infos}:
37+
expected %{num} but found %{found_num}. %{infos}:
3838
en: 'expected %{num} but found %{found_num}. %{infos}'
3939
zh_CN: '期望 %{num} 但找到 %{found_num}。%{infos}'
4040
zh_HK: '期望 %{num} 但找到 %{found_num}。%{infos}'

crates/emmylua_code_analysis/resources/std/jit/util.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ end
7676
---@param tr Trace
7777
---@param ref integer
7878
---@return integer? m
79-
---@return integer? ot
79+
---@return integer? ot --spellchecker:disable-line
8080
---@return integer? op1
8181
---@return integer? op2
8282
---@return integer? prev

crates/emmylua_code_analysis/resources/std/string/buffer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
---
1010
--- The convenient string buffer API simplifies common string manipulation tasks, that would otherwise require creating many intermediate strings. String buffers improve performance by eliminating redundant memory copies, object creation, string interning and garbage collection overhead. In conjunction with the FFI library, they allow zero-copy operations.
1111
---
12-
--- The string buffer libary also includes a high-performance serializer for Lua objects.
12+
--- The string buffer library also includes a high-performance serializer for Lua objects.
1313
---
1414
---
1515
--- ## Streaming Serialization

crates/emmylua_code_analysis/src/db_index/type/type_assert.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,34 +220,34 @@ fn narrow_down_type(source: LuaType, target: LuaType) -> LuaType {
220220
}
221221
}
222222

223-
fn add_type(source: LuaType, addded_typ: LuaType) -> LuaType {
224-
if addded_typ.is_nil() {
223+
fn add_type(source: LuaType, added_typ: LuaType) -> LuaType {
224+
if added_typ.is_nil() {
225225
return LuaType::Nullable(source.into());
226226
}
227227

228228
match source {
229229
LuaType::Union(union) => {
230230
let mut types = union.get_types().to_vec();
231-
types.push(addded_typ);
231+
types.push(added_typ);
232232
LuaType::Union(LuaUnionType::new(types).into())
233233
}
234234
LuaType::Nullable(inner) => {
235-
let inner = add_type((*inner).clone(), addded_typ);
235+
let inner = add_type((*inner).clone(), added_typ);
236236
LuaType::Nullable(inner.into())
237237
}
238-
LuaType::Unknown | LuaType::Any => addded_typ,
238+
LuaType::Unknown | LuaType::Any => added_typ,
239239
_ => {
240-
if source.is_number() && addded_typ.is_number() {
240+
if source.is_number() && added_typ.is_number() {
241241
return LuaType::Number;
242-
} else if source.is_string() && addded_typ.is_string() {
242+
} else if source.is_string() && added_typ.is_string() {
243243
return LuaType::String;
244-
} else if source.is_boolean() && addded_typ.is_boolean() {
244+
} else if source.is_boolean() && added_typ.is_boolean() {
245245
return LuaType::Boolean;
246-
} else if source.is_table() && addded_typ.is_table() {
246+
} else if source.is_table() && added_typ.is_table() {
247247
return LuaType::Table;
248248
}
249249

250-
LuaType::Union(LuaUnionType::new(vec![source, addded_typ]).into())
250+
LuaType::Union(LuaUnionType::new(vec![source, added_typ]).into())
251251
},
252252
}
253253
}

crates/emmylua_code_analysis/src/diagnostic/checker/access_invisible.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ fn check_name_expr(
4040
}
4141

4242
let name_token = name_expr.get_name_token()?;
43-
if !semantic_model.is_property_visiable(name_token.syntax().clone(), property_owner.clone()) {
43+
if !semantic_model.is_property_visible(name_token.syntax().clone(), property_owner.clone()) {
4444
let emmyrc = semantic_model.get_emmyrc();
45-
report_reson(context, &emmyrc, name_token.get_range(), property_owner);
45+
report_reason(context, &emmyrc, name_token.get_range(), property_owner);
4646
}
4747
Some(())
4848
}
@@ -62,15 +62,15 @@ fn check_index_expr(
6262
}
6363

6464
let index_token = index_expr.get_index_name_token()?;
65-
if !semantic_model.is_property_visiable(index_token.clone(), property_owner.clone()) {
65+
if !semantic_model.is_property_visible(index_token.clone(), property_owner.clone()) {
6666
let emmyrc = semantic_model.get_emmyrc();
67-
report_reson(context, &emmyrc, index_token.text_range(), property_owner);
67+
report_reason(context, &emmyrc, index_token.text_range(), property_owner);
6868
}
6969

7070
Some(())
7171
}
7272

73-
fn report_reson(
73+
fn report_reason(
7474
context: &mut DiagnosticContext,
7575
emmyrc: &Emmyrc,
7676
range: TextRange,
@@ -83,8 +83,8 @@ fn report_reson(
8383

8484
if let Some(version_conds) = &property.version_conds {
8585
let version_number = emmyrc.runtime.version.to_lua_version_number();
86-
let visiable = version_conds.iter().any(|cond| cond.check(&version_number));
87-
if !visiable {
86+
let visible = version_conds.iter().any(|cond| cond.check(&version_number));
87+
if !visible {
8888
let message = t!(
8989
"The current Lua version %{version} is not accessible; expected %{conds}.",
9090
version = version_number,
@@ -105,8 +105,8 @@ fn report_reson(
105105
}
106106
}
107107

108-
if let Some(visiblity) = property.visibility {
109-
let message = match visiblity {
108+
if let Some(visibility) = property.visibility {
109+
let message = match visibility {
110110
VisibilityKind::Protected => {
111111
t!("The property is protected and cannot be accessed outside its subclasses.")
112112
}

0 commit comments

Comments
 (0)