Skip to content

Commit

Permalink
Fix issues with check on multiple paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gavin committed Feb 9, 2024
1 parent 618c5db commit 3eb1e0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/server/check.odin
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
entry_point_opt :=
filepath.ext(path) == ".odin" ? "-file" : "-no-entry-point"

slice.zero(data)

if code, ok, buffer = common.run_executable(
fmt.tprintf(
"%v check %s %s %s %s %s",
Expand Down Expand Up @@ -117,7 +119,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
}
}

error.uri = string(buffer[source_pos:s.src_pos - 1])
error.uri = strings.clone(string(buffer[source_pos:s.src_pos - 1]), context.temp_allocator)

left_paren := scanner.scan(&s)

Expand Down Expand Up @@ -145,7 +147,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
if seperator != ':' {
break scan_line
}

rhs_digit := scanner.scan(&s)

if rhs_digit != scanner.Int {
Expand All @@ -157,7 +159,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
if !ok {
break scan_line
}

right_paren := scanner.scan(&s)

if right_paren != ')' {
Expand All @@ -178,7 +180,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
continue
}

error.message = string(buffer[source_pos:s.src_pos - 1])
error.message = strings.clone(string(buffer[source_pos:s.src_pos - 1]), context.temp_allocator)
error.column = column
error.line = line

Expand Down
4 changes: 3 additions & 1 deletion src/server/requests.odin
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,9 @@ notification_did_save :: proc(
if len(config.profile.checker_path) > 0 {
check(config.profile.checker_path[:], writer, config)
} else {
check({config.workspace_folders[0].uri}, writer, config)
if uri, ok := common.parse_uri(config.workspace_folders[0].uri, context.temp_allocator); ok {
check({uri.path}, writer, config)
}
}

return .None
Expand Down

0 comments on commit 3eb1e0e

Please sign in to comment.