Skip to content

Commit

Permalink
analyzer: add pub access modifier to publicly used struct fields (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm authored Apr 6, 2024
1 parent f2d718c commit 395d22e
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/analyzer/psi/ReferenceImpl.v
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub fn (r &ReferenceImpl) resolve() ?PsiElement {
}

pub struct SubResolver {
pub:
containing_file &PsiFile
element ReferenceExpressionBase
for_types bool
Expand Down
2 changes: 2 additions & 0 deletions src/analyzer/psi/StubbedElementTypeImpl.v
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ pub fn (s &StubbedElementType) create_stub(psi PsiElement, parent_stub &StubBase

@[params]
struct StubParams {
pub:
include_text bool
additional string
}
Expand All @@ -617,6 +618,7 @@ pub fn declaration_stub(psi PsiNamedElement, parent_stub &StubElement, stub_type

@[params]
struct TestStubParams {
pub:
include_text bool = true
}

Expand Down
1 change: 1 addition & 0 deletions src/analyzer/psi/search/ReferencesSearch.v
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import loglib

@[params]
pub struct SearchParams {
pub:
// include_declaration indicates whether to include the declaration
// of the symbol in the search results
// This is useful when we want to find all usages of a symbol for
Expand Down
1 change: 1 addition & 0 deletions src/jsonrpc/jsonrpc.v
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ pub fn (e ResponseError) err() IError {

@[params]
pub struct ResponseErrorGeneratorParams {
pub:
error IError @[required]
data string
}
Expand Down
1 change: 1 addition & 0 deletions src/jsonrpc/server.v
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ fn (mut s Server) internal_respond(mut base_rw ResponseWriter) ! {

@[params]
pub struct NewWriterConfig {
pub:
own_buffer bool
}

Expand Down
1 change: 1 addition & 0 deletions src/lsp/document_highlight.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module lsp
// response: []DocumentHighlight | none
// request: TextDocumentPositionParams
pub struct DocumentHighlight {
pub:
range Range
kind DocumentHighlightKind
}
Expand Down
2 changes: 2 additions & 0 deletions src/lsp/signature_help.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module lsp

pub struct SignatureHelpOptions {
pub:
trigger_characters []string @[json: triggerCharacters]
retrigger_characters []string @[json: retriggerCharacters]
}
Expand Down Expand Up @@ -47,6 +48,7 @@ pub mut:
}

pub struct ParameterInformation {
pub:
label string
}

Expand Down
3 changes: 3 additions & 0 deletions src/lsp/window.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module lsp
// method: ‘window/showMessage’
// notification
pub struct ShowMessageParams {
pub:
@type MessageType
// @type int
message string
Expand All @@ -19,6 +20,7 @@ pub enum MessageType {
// method: ‘window/showMessageRequest’
// response: MessageActionItem | none / null
pub struct ShowMessageRequestParams {
pub:
@type MessageType
message string
actions []MessageActionItem
Expand All @@ -31,6 +33,7 @@ pub struct MessageActionItem {
// method: ‘window/logMessage’
// notification
pub struct LogMessageParams {
pub:
@type MessageType
message string
}
Expand Down
8 changes: 3 additions & 5 deletions src/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ fn run(cmd cli.Command) ! {
mut ls := server.LanguageServer.new(analyzer.IndexingManager.new())
mut jrpc_server := &jsonrpc.Server{
stream: stream
interceptors: [
&log.LogRecorder{
enabled: true
},
]
handler: ls
}
mut lr := log.LogRecorder{}
lr.enable()
jrpc_server.interceptors = [&lr]

defer {
mut out := loglib.get_output()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import analyzer.lang
import server.completion

pub struct ReferenceCompletionProcessor {
pub:
file &psi.PsiFile
module_fqn string
root string
Expand Down
1 change: 1 addition & 0 deletions src/server/hints/InlayHintsVisitor.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import analyzer.psi
import analyzer.psi.types

pub struct InlayHintsVisitor {
pub:
cfg config.InlayHintsConfig
pub mut:
lines int
Expand Down
1 change: 1 addition & 0 deletions src/server/inspections/compiler/CompilerReportsSource.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import lsp
import server.inspections

pub struct CompilerReportsSource {
pub:
compiler_path string
}

Expand Down
3 changes: 2 additions & 1 deletion src/testing/BenchmarkRunner.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module testing

pub struct BenchmarkRunner {
mut:
benchmarks []&Benchmark
benchmarks []&Benchmark
pub mut:
last_fixture &Fixture
}

Expand Down
1 change: 1 addition & 0 deletions tree_sitter_v/bindings/bindings.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn (mut p Parser[T]) reset() {

@[params]
pub struct ParseConfig {
pub:
source string @[required]
tree &TSTree = &TSTree(unsafe { nil })
}
Expand Down

0 comments on commit 395d22e

Please sign in to comment.