Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format all the files with the new vfmt #121

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions install.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ mut cmd := cli.Command{
release_type := get_release_type(cmd)
install(no_interaction, release_type)!
}
flags: [
flags: [
cli.Flag{
flag: .bool
name: 'no-interaction' // Used primarily for VS Code extension, to install v-analyzer from sources
Expand All @@ -508,7 +508,7 @@ cmd.add_command(cli.Command{
release_type := get_release_type(cmd)
update(nightly, release_type)!
}
flags: [
flags: [
cli.Flag{
flag: .bool
name: 'nightly'
Expand Down
10 changes: 5 additions & 5 deletions src/analyzer/index/IndexDeserializer.v
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ pub fn (mut d IndexDeserializer) deserialize_stub() &psi.StubBase {
end_line: identifier_end_line
end_column: identifier_end_column
}
text_range: psi.TextRange{
text_range: psi.TextRange{
line: line
column: column
end_line: end_line
end_column: end_column
}
parent_id: parent_id
stub_list: unsafe { nil } // will be set later
stub_type: stub_type
id: id
parent_id: parent_id
stub_list: unsafe { nil } // will be set later
stub_type: stub_type
id: id
}
}
2 changes: 1 addition & 1 deletion src/analyzer/index/IndexingRoot.v
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn (mut i IndexingRoot) index_file(path string, content string) !FileIndex {
kind: unsafe { psi.StubIndexLocationKind(u8(i.kind)) }
stub_list: unsafe { nil }
}
stub_list: unsafe { nil }
stub_list: unsafe { nil }
}
stub_tree := build_stub_tree(psi_file, i.root)

Expand Down
10 changes: 5 additions & 5 deletions src/bytes/serialization_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ fn test_serialize_deserialize_stub_element() {
end_line: 3
end_column: 4
}
stub_type: .function_declaration
id: 123456
text: 'some text with spaces'
comment: '// comment data'
receiver: 'Foo'
stub_type: .function_declaration
id: 123456
text: 'some text with spaces'
comment: '// comment data'
receiver: 'Foo'
}

serialize_stub_element(mut s, data)
Expand Down
2 changes: 1 addition & 1 deletion src/jsonrpc/server.v
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn (s &Server) writer(cfg NewWriterConfig) &ResponseWriter {
},
]
}
sb: if cfg.own_buffer { s.res_buf.clone() } else { s.res_buf }
sb: if cfg.own_buffer { s.res_buf.clone() } else { s.res_buf }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/code_lens/CodeLensVisitor.v
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub fn (mut v CodeLensVisitor) add_lens(node psi.AstNode, cmd lsp.Command) {
character: int(start_point.column)
}
v.result << lsp.CodeLens{
range: lsp.Range{
range: lsp.Range{
start: start
end: start
}
Expand Down
64 changes: 32 additions & 32 deletions src/server/completion/providers/ReferenceCompletionProcessor.v
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {

if element is psi.VarDefinition {
c.add_item(
label: name
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
label: name
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
description: element.get_type().readable_name()
}
documentation: ''
Expand All @@ -60,10 +60,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {

if element is psi.ParameterDeclaration {
c.add_item(
label: name
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
label: name
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
description: element.get_type().readable_name()
}
documentation: ''
Expand All @@ -75,10 +75,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {

if element is psi.Receiver {
c.add_item(
label: element.name()
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
label: element.name()
kind: .variable
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
description: element.get_type().readable_name()
}
documentation: ''
Expand Down Expand Up @@ -134,9 +134,9 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {
insert_text_builder.write_string('$0')

c.add_item(
label: '${name}'
kind: if receiver_text == '' { .function } else { .method }
label_details: lsp.CompletionItemLabelDetails{
label: '${name}'
kind: if receiver_text == '' { .function } else { .method }
label_details: lsp.CompletionItemLabelDetails{
detail: signature.get_text()
}
detail: 'fn ${receiver_text}${element.name()}${generic_parameters_text}${signature.get_text()}'
Expand Down Expand Up @@ -194,9 +194,9 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {
insert_text_builder.write_string('$0')

c.add_item(
label: '${name}'
kind: .method
label_details: lsp.CompletionItemLabelDetails{
label: '${name}'
kind: .method
label_details: lsp.CompletionItemLabelDetails{
detail: signature.get_text()
}
detail: 'fn ${receiver_text}${element.name()}${generic_parameters_text}${signature.get_text()}'
Expand Down Expand Up @@ -238,10 +238,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {

if element is psi.ConstantDefinition {
c.add_item(
label: element.name()
kind: .constant
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
label: element.name()
kind: .constant
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
description: element.get_type().readable_name()
}
documentation: element.doc_comment()
Expand All @@ -260,10 +260,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {
}

c.add_item(
label: element.name()
kind: .field
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
label: element.name()
kind: .field
detail: element.get_type().readable_name()
label_details: lsp.CompletionItemLabelDetails{
description: element.get_type().readable_name()
}
documentation: element.doc_comment()
Expand All @@ -290,10 +290,10 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {
''
}
c.add_item(
label: element.name()
kind: .method
detail: 'fn ${element.name()}${signature.get_text()}'
label_details: lsp.CompletionItemLabelDetails{
label: element.name()
kind: .method
detail: 'fn ${element.name()}${signature.get_text()}'
label_details: lsp.CompletionItemLabelDetails{
detail: signature.get_text()
description: owner_name
}
Expand Down Expand Up @@ -339,8 +339,8 @@ fn (mut c ReferenceCompletionProcessor) execute(element psi.PsiElement) bool {
label_details: lsp.CompletionItemLabelDetails{
detail: ' (global defined in ${module_name})'
}
kind: .variable
insert_text: element.name()
kind: .variable
insert_text: element.name()
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/server/diagnostics.v
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ fn (_ &DiagnosticReporter) convert_report(report inspections.Report) lsp.Diagnos
.warning { lsp.DiagnosticSeverity.warning }
.notice { lsp.DiagnosticSeverity.information }
}
source: 'compiler'
message: report.message
tags: tags
source: 'compiler'
message: report.message
tags: tags
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/features_hover.v
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ pub fn (mut ls LanguageServer) hover(params lsp.HoverParams) ?lsp.Hover {
return lsp.Hover{
contents: lsp.hover_markdown_string('```\n' + grand_elem + '\n ' + parent_elem +
'\n ' + this + '\n```')
range: tform.text_range_to_lsp_range(element.text_range())
range: tform.text_range_to_lsp_range(element.text_range())
}
}

return lsp.Hover{
contents: lsp.hover_markdown_string(element.type_name() + ': ' +
element.node.type_name.str())
range: tform.text_range_to_lsp_range(element.text_range())
range: tform.text_range_to_lsp_range(element.text_range())
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/server/file_diff/Diff.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn (mut diff Diff) append_to_begin(line int, text string) {
pub fn (mut diff Diff) append_to(line int, col int, text string) {
pos := Diff.line_pos(line, col)
diff.edits << Edit{
range: lsp.Range{
range: lsp.Range{
start: pos
end: pos
}
Expand All @@ -37,7 +37,7 @@ pub fn (mut diff Diff) append_to(line int, col int, text string) {
pub fn (mut diff Diff) append_as_prev_line(line int, text string) {
pos := Diff.line_begin_pos(line)
diff.edits << Edit{
range: lsp.Range{
range: lsp.Range{
start: pos
end: pos
}
Expand All @@ -48,7 +48,7 @@ pub fn (mut diff Diff) append_as_prev_line(line int, text string) {
pub fn (mut diff Diff) append_as_next_line(line int, text string) {
pos := Diff.line_begin_pos(line)
diff.edits << Edit{
range: lsp.Range{
range: lsp.Range{
start: pos
end: pos
}
Expand Down
32 changes: 16 additions & 16 deletions src/server/general.v
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn (mut ls LanguageServer) initialize(params lsp.InitializeParams, mut wr Re

return lsp.InitializeResult{
capabilities: lsp.ServerCapabilities{
text_document_sync: lsp.TextDocumentSyncOptions{
text_document_sync: lsp.TextDocumentSyncOptions{
open_close: true
change: .full
will_save: true
Expand All @@ -54,36 +54,36 @@ pub fn (mut ls LanguageServer) initialize(params lsp.InitializeParams, mut wr Re
resolve_provider: false
trigger_characters: ['.', ':', '(', '@']
}
signature_help_provider: lsp.SignatureHelpOptions{
signature_help_provider: lsp.SignatureHelpOptions{
trigger_characters: ['(', ',']
retrigger_characters: [',', ' ']
}
code_lens_provider: lsp.CodeLensOptions{}
inlay_hint_provider: lsp.InlayHintOptions{}
semantic_tokens_provider: lsp.SemanticTokensOptions{
code_lens_provider: lsp.CodeLensOptions{}
inlay_hint_provider: lsp.InlayHintOptions{}
semantic_tokens_provider: lsp.SemanticTokensOptions{
legend: lsp.SemanticTokensLegend{
token_types: semantic.semantic_types
token_modifiers: semantic.semantic_modifiers
}
range: true
full: true
range: true
full: true
}
rename_provider: lsp.RenameOptions{
rename_provider: lsp.RenameOptions{
prepare_provider: false
}
document_symbol_provider: true
workspace_symbol_provider: true
implementation_provider: true
document_highlight_provider: true
code_action_provider: lsp.CodeActionOptions{
document_symbol_provider: true
workspace_symbol_provider: true
implementation_provider: true
document_highlight_provider: true
code_action_provider: lsp.CodeActionOptions{
code_action_kinds: [lsp.quick_fix]
}
folding_range_provider: true
execute_command_provider: lsp.ExecuteCommandOptions{
folding_range_provider: true
execute_command_provider: lsp.ExecuteCommandOptions{
commands: arrays.concat(ls.intentions.values().map(it.id), ...ls.compiler_quick_fixes.values().map(it.id))
}
}
server_info: lsp.ServerInfo{
server_info: lsp.ServerInfo{
name: metadata.manifest.name
version: metadata.manifest.version
}
Expand Down
Loading