Skip to content

Commit 7d8b919

Browse files
Merge branch 'master' into dev
2 parents 510033b + 3a7705a commit 7d8b919

File tree

8 files changed

+107
-18
lines changed

8 files changed

+107
-18
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
> - [Adding timeout when fetching plugin & more clear plugin error message #3389](https://github.com/zyedidia/micro/pull/3389)
1313
> - [Adding Jumping to opening and closing brace logic and actions #3384](https://github.com/zyedidia/micro/pull/3384)
1414
> - [Adding auto complete support for multi cursors #3442](https://github.com/zyedidia/micro/pull/3442)
15-
> - [Fixing comment plugin not using user settings when overriding default setting #3424](https://github.com/zyedidia/micro/pull/3424)
1615
> - [Add the ability lock settings.json and bindings.json for plugins #3618](https://github.com/zyedidia/micro/pull/3618)
1716
> - [Adding error screen for lua functions running in status line #3691](https://github.com/zyedidia/micro/pull/3691)
1817
> - [Adding lua function to use result of RunBackgroundShell #3692](https://github.com/zyedidia/micro/pull/3692)
@@ -21,7 +20,7 @@
2120
> To see the diff between this and upstream master, click [here](https://github.com/zyedidia/micro/compare/master...Neko-Box-Coder:micro-dev:dev)
2221
2322
### Builds
24-
Just like the offical release, you can find the nightly build of this branch under [Nightly Release](https://github.com/Neko-Box-Coder/micro-dev/releases/tag/nightly)
23+
Just like the official release, you can find the nightly build of this branch under [Nightly Release](https://github.com/Neko-Box-Coder/micro-dev/releases/tag/nightly)
2524

2625
> ### TODO
2726
> - Create CI/CD pipeline to build and release for new changes

cmd/micro/micro.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func main() {
317317
// flag options
318318
for k, v := range optionFlags {
319319
if *v != "" {
320-
nativeValue, err := config.GetNativeValue(k, config.DefaultAllSettings()[k], *v)
320+
nativeValue, err := config.GetNativeValue(k, *v)
321321
if err != nil {
322322
screen.TermMessage(err)
323323
continue

internal/action/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ func SetGlobalOption(option, value string) error {
706706
return config.ErrInvalidOption
707707
}
708708

709-
nativeValue, err := config.GetNativeValue(option, config.GlobalSettings[option], value)
709+
nativeValue, err := config.GetNativeValue(option, value)
710710
if err != nil {
711711
return err
712712
}

internal/action/globals.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ var LogBufPane *BufPane
1111
// InitGlobals initializes the log buffer and the info bar
1212
func InitGlobals() {
1313
InfoBar = NewInfoBar()
14-
buffer.LogBuf = buffer.NewBufferFromString("", "Log", buffer.BTLog)
14+
buffer.LogBuf = buffer.NewBufferFromString("", "", buffer.BTLog)
15+
buffer.LogBuf.SetName("Log")
1516
}
1617

1718
// GetInfoBar returns the infobar pane

internal/action/rawpane.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func NewRawPaneFromWin(b *buffer.Buffer, win display.BWindow, tab *Tab) *RawPane
2222

2323
func NewRawPane(tab *Tab) *RawPane {
2424
b := buffer.NewBufferFromString("", "", buffer.BTRaw)
25+
b.SetName("Raw event viewer")
26+
2527
w := display.NewBufWindow(0, 0, 0, 0, b)
28+
2629
return NewRawPaneFromWin(b, w, tab)
2730
}
2831

internal/buffer/settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (b *Buffer) SetOption(option, value string) error {
155155
return config.ErrInvalidOption
156156
}
157157

158-
nativeValue, err := config.GetNativeValue(option, b.Settings[option], value)
158+
nativeValue, err := config.GetNativeValue(option, value)
159159
if err != nil {
160160
return err
161161
}

internal/config/settings.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -486,28 +486,30 @@ func DefaultAllSettings() map[string]interface{} {
486486
}
487487

488488
// GetNativeValue parses and validates a value for a given option
489-
func GetNativeValue(option string, realValue interface{}, value string) (interface{}, error) {
490-
var native interface{}
491-
kind := reflect.TypeOf(realValue).Kind()
492-
if kind == reflect.Bool {
489+
func GetNativeValue(option, value string) (interface{}, error) {
490+
curVal := GetGlobalOption(option)
491+
if curVal == nil {
492+
return nil, ErrInvalidOption
493+
}
494+
495+
switch kind := reflect.TypeOf(curVal).Kind(); kind {
496+
case reflect.Bool:
493497
b, err := util.ParseBool(value)
494498
if err != nil {
495499
return nil, ErrInvalidValue
496500
}
497-
native = b
498-
} else if kind == reflect.String {
499-
native = value
500-
} else if kind == reflect.Float64 {
501+
return b, nil
502+
case reflect.String:
503+
return value, nil
504+
case reflect.Float64:
501505
f, err := strconv.ParseFloat(value, 64)
502506
if err != nil {
503507
return nil, ErrInvalidValue
504508
}
505-
native = f
506-
} else {
509+
return f, nil
510+
default:
507511
return nil, ErrInvalidValue
508512
}
509-
510-
return native, nil
511513
}
512514

513515
// OptionIsValid checks if a value is valid for a certain option

runtime/syntax/prql.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# https://prql-lang.org/
2+
# https://github.com/PRQL/prql
3+
filetype: prql
4+
5+
detect:
6+
filename: "\\.prql$"
7+
8+
rules:
9+
- statement: "\\b(let|module|into|case|type|func)\\b"
10+
11+
# Types
12+
- type: "\\b(u?int(8|16|32|64)?|float(32|64)|bool|text|date|time|timestamp)\\b"
13+
- type.keyword: "\\b(enum)\\b"
14+
- constant.bool: "\\b(true|false|null|this|that)\\b"
15+
16+
# Built-in functions
17+
- identifier: "\\b(abs|floor|ceil|pi|exp|ln|log10|log|sqrt|degrees|radians|cos|acos|sin|asin|tan|atan|pow|round)\\b" # Math module
18+
- identifier: "\\b(min|max|sum|average|stddev|all|any|concat_array|count)\\b" # Aggregate functions
19+
- identifier: "\\b(lag|lead|first|last|rank|rank_dense|row_number)\\b" # Window functions
20+
- identifier: "\\b(tuple_every|tuple_map|tuple_zip|_eq|_is_null)\\b" # Tuple functions
21+
- identifier: "\\b(as|in|from_text)\\b" # Misc
22+
- identifier: "\\b(lower|upper|ltrim|rtrim|trim|length|extract|replace|starts_with|contains|ends_with)\\b" # Text module
23+
- identifier: "\\b(to_text)\\b" # Date module
24+
- identifier: "\\b(read_parquet|read_csv)\\b" # File-reading functions
25+
26+
# Modules
27+
- identifier.class: "\\b(math|text|date|prql)\\b"
28+
29+
# Transforms
30+
- statement: "\\b(aggregate|derive|filter|from|group|join|select|sort|take|window)\\b"
31+
32+
# Operators
33+
- symbol.operator: "([~^.:;,+*|=!\\%@?]|<|>|/|-|&)"
34+
35+
# Brackets
36+
- symbol.brackets: "[{}()\\[\\]]"
37+
38+
# Numbers
39+
- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal
40+
- constant.number: "\\b0b(_?[01])+\\b" # bin
41+
- constant.number: "\\b0o(_?[0-7])+\\b" # oct
42+
- constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex
43+
- constant: "\\b[0-9]+(years|months|weeks|days|hours|minutes|seconds|milliseconds|microseconds)\\b"
44+
45+
- constant.string:
46+
start: "[frs]?\"\"\""
47+
end: "\"\"\""
48+
skip: "\\\\."
49+
rules:
50+
- constant.specialChar: "\\\\[bfnrt'\"\\\\]"
51+
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
52+
53+
- constant.string:
54+
start: "[frs]?'''"
55+
end: "'''"
56+
skip: "\\\\."
57+
rules:
58+
- constant.specialChar: "\\\\[bfnrt'\"\\\\]"
59+
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
60+
61+
- constant.string:
62+
start: "[frs]?\""
63+
end: "\""
64+
skip: "\\\\."
65+
rules:
66+
- constant.specialChar: "\\\\[bfnrt'\"\\\\]"
67+
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
68+
69+
- constant.string:
70+
start: "[frs]?'"
71+
end: "'"
72+
skip: "\\\\."
73+
rules:
74+
- constant.specialChar: "\\\\[bfnrt'\"\\\\]"
75+
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
76+
77+
- comment:
78+
start: "#"
79+
end: "$"
80+
rules:
81+
- todo: "(TODO|FIXME|NOTE):?"
82+
83+
# Decorators
84+
- preproc: "@\\{([a-z]+(=[a-z0-9]+,?)?)*\\}"

0 commit comments

Comments
 (0)