Skip to content

Commit 3f4f84a

Browse files
committed
시그니처 기능 개선
1 parent 60c9ce7 commit 3f4f84a

72 files changed

Lines changed: 796 additions & 35 deletions

Some content is hidden

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

src/sql_text.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ pub const ORACLE_SQL_KEYWORDS: &[&str] = &[
381381
"ONE",
382382
"ONLY",
383383
"OPEN",
384+
"OPERATOR",
384385
"OPTIMIZER_MODE",
385386
"OR",
386387
"ORDER",

src/ui/builtin_signatures.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7168,6 +7168,7 @@ pub const MARIADB_FUNCTIONS: &[&str] = &[
71687168
"EXTRACTVALUE",
71697169
"FIELD",
71707170
"FIND_IN_SET",
7171+
"FIRST_VALUE",
71717172
"FLOOR",
71727173
"FORMAT",
71737174
"FORMAT_BYTES",
@@ -7256,11 +7257,13 @@ pub const MARIADB_FUNCTIONS: &[&str] = &[
72567257
"JSON_VALID",
72577258
"JSON_VALUE",
72587259
"KDF",
7260+
"LAG",
72597261
"LASTVAL",
72607262
"LAST_DAY",
72617263
"LAST_INSERT_ID",
72627264
"LAST_VALUE",
72637265
"LCASE",
7266+
"LEAD",
72647267
"LEAST",
72657268
"LEFT",
72667269
"LENGTH",
@@ -7323,6 +7326,7 @@ pub const MARIADB_FUNCTIONS: &[&str] = &[
73237326
"NATURAL_SORT_KEY",
73247327
"NEXTVAL",
73257328
"NOW",
7329+
"NTH_VALUE",
73267330
"NTILE",
73277331
"NULLIF",
73287332
"NUMGEOMETRIES",
@@ -7362,6 +7366,7 @@ pub const MARIADB_FUNCTIONS: &[&str] = &[
73627366
"REGEXP_REPLACE",
73637367
"REGEXP_SUBSTR",
73647368
"RELEASE_LOCK",
7369+
"REPLACE",
73657370
"REVERSE",
73667371
"RIGHT",
73677372
"ROUND",
@@ -7515,6 +7520,7 @@ pub const MARIADB_FUNCTIONS: &[&str] = &[
75157520
"UUID_SHORT",
75167521
"UUID_V4",
75177522
"UUID_V7",
7523+
"VALUES",
75187524
"VARIANCE",
75197525
"VAR_POP",
75207526
"VAR_SAMP",
@@ -8254,6 +8260,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
82548260
],
82558261
argument_separator_keywords: &[],
82568262
},
8263+
BuiltinSignature {
8264+
name: "FIRST_VALUE",
8265+
syntaxes: &[
8266+
"FIRST_VALUE(expr) OVER ( [ PARTITION BY partition_expression ] [ ORDER BY order_list ] )",
8267+
],
8268+
argument_separator_keywords: &[],
8269+
},
82578270
BuiltinSignature {
82588271
name: "FLOOR",
82598272
syntaxes: &[
@@ -8871,6 +8884,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
88718884
],
88728885
argument_separator_keywords: &[],
88738886
},
8887+
BuiltinSignature {
8888+
name: "LAG",
8889+
syntaxes: &[
8890+
"LAG(expr[, offset]) OVER ( [ PARTITION BY partition_expression ] [ ORDER BY order_list ] )",
8891+
],
8892+
argument_separator_keywords: &[],
8893+
},
88748894
BuiltinSignature {
88758895
name: "LASTVAL",
88768896
syntaxes: &[
@@ -8907,6 +8927,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
89078927
],
89088928
argument_separator_keywords: &[],
89098929
},
8930+
BuiltinSignature {
8931+
name: "LEAD",
8932+
syntaxes: &[
8933+
"LEAD(expr[, offset]) OVER ( [ PARTITION BY partition_expression ] [ ORDER BY order_list ] )",
8934+
],
8935+
argument_separator_keywords: &[],
8936+
},
89108937
BuiltinSignature {
89118938
name: "LEAST",
89128939
syntaxes: &[
@@ -9341,6 +9368,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
93419368
],
93429369
argument_separator_keywords: &[],
93439370
},
9371+
BuiltinSignature {
9372+
name: "NTH_VALUE",
9373+
syntaxes: &[
9374+
"NTH_VALUE(expr, num_row) OVER ( [ PARTITION BY partition_expression ] [ ORDER BY order_list ] )",
9375+
],
9376+
argument_separator_keywords: &[],
9377+
},
93449378
BuiltinSignature {
93459379
name: "NTILE",
93469380
syntaxes: &[
@@ -9614,6 +9648,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
96149648
],
96159649
argument_separator_keywords: &[],
96169650
},
9651+
BuiltinSignature {
9652+
name: "REPLACE",
9653+
syntaxes: &[
9654+
"REPLACE(str,from_str,to_str)",
9655+
],
9656+
argument_separator_keywords: &[],
9657+
},
96179658
BuiltinSignature {
96189659
name: "REVERSE",
96199660
syntaxes: &[
@@ -10695,6 +10736,13 @@ const MARIADB_SIGNATURES: &[BuiltinSignature] = &[
1069510736
],
1069610737
argument_separator_keywords: &[],
1069710738
},
10739+
BuiltinSignature {
10740+
name: "VALUES",
10741+
syntaxes: &[
10742+
"VALUES(col_name)",
10743+
],
10744+
argument_separator_keywords: &[],
10745+
},
1069810746
BuiltinSignature {
1069910747
name: "VARIANCE",
1070010748
syntaxes: &[

src/ui/builtin_signatures_live_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn assert_catalog(db_type: DatabaseType, names: &[&str], expected_len: usize) {
3232
fn builtin_signature_catalogs_match_official_manual_indices() {
3333
assert_catalog(DatabaseType::Oracle, ORACLE_FUNCTIONS, 463);
3434
assert_catalog(DatabaseType::MySQL, MYSQL_FUNCTIONS, 408);
35-
assert_catalog(DatabaseType::MariaDB, MARIADB_FUNCTIONS, 469);
35+
assert_catalog(DatabaseType::MariaDB, MARIADB_FUNCTIONS, 475);
3636
}
3737

3838
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -961,5 +961,5 @@ fn mysql_builtin_function_signatures_execute_live() {
961961
#[test]
962962
#[ignore = "requires local MariaDB 12.2 via SPACE_QUERY_TEST_MYSQL_* environment variables"]
963963
fn mariadb_builtin_function_signatures_execute_live() {
964-
run_mysql_catalog_live(DatabaseType::MariaDB, MARIADB_FUNCTIONS, 469);
964+
run_mysql_catalog_live(DatabaseType::MariaDB, MARIADB_FUNCTIONS, 475);
965965
}

src/ui/intellisense.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub static MARIADB_FUNCTIONS_SET: once_cell::sync::Lazy<std::collections::HashSe
3131

3232
const FUNCTION_SUFFIX: &str = "()";
3333
const ORACLE_BUILTIN_PACKAGES: &[&str] = &[
34+
"DBMS_DB_VERSION",
3435
"DBMS_OUTPUT",
3536
"DBMS_LOB",
3637
"DBMS_SQL",
@@ -2055,9 +2056,11 @@ impl IntellisenseData {
20552056
"JAVA CLASS"
20562057
} else if has(&self.java_resource_entries) {
20572058
"JAVA RESOURCE"
2059+
} else if has(&self.schema_entries) {
2060+
"SCHEMA"
20582061
} else if has(&self.user_entries) {
20592062
"USER"
2060-
} else if self.is_catalog_keyword(upper.as_str(), db_type) {
2063+
} else if self.is_catalog_keyword_suggestion(upper.as_str(), db_type) {
20612064
"KEYWORD"
20622065
} else {
20632066
return None;
@@ -2070,6 +2073,18 @@ impl IntellisenseData {
20702073
keywords.binary_search(&upper).is_ok()
20712074
}
20722075

2076+
fn is_catalog_keyword_suggestion(
2077+
&self,
2078+
upper: &str,
2079+
db_type: Option<crate::db::DatabaseType>,
2080+
) -> bool {
2081+
self.is_catalog_keyword(upper, db_type)
2082+
|| (upper.contains(' ')
2083+
&& upper
2084+
.split_ascii_whitespace()
2085+
.all(|word| self.is_catalog_keyword(word, db_type)))
2086+
}
2087+
20732088
/// True when `upper` (an upper-cased token) is a reserved language keyword for
20742089
/// the dialect. Lets IntelliSense tell a base-catalog keyword apart from a
20752090
/// column/object name when filtering expression completions.

0 commit comments

Comments
 (0)