Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 16 additions & 2 deletions scripts/generateFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,23 @@ const convertTypeToRbs: ((type: string) => string) = (type) => {
return "untyped";
};

Handlebars.registerHelper("method_signature", (members: InterfaceResult["members"]) => {
Handlebars.registerHelper("constructor_signature", (members: InterfaceResult["members"]) => {
return members
.map(
(member) =>
`${member.optional ? "?" : ""}${snake(member.name)}: ${convertTypeToRbs(member.type)}${member.nullable ? "?" : ""}`
)
.join(", ");
});
Handlebars.registerHelper("attribute_signature", (member: SerializeResult) => {
const rbsType = convertTypeToRbs(member.type);
let suffix = "";
if (rbsType !== "untyped" && rbsType !== "nil") {
suffix = member.optional || member.nullable ? "?" : "";
}

return `${rbsType}${suffix}`;
});
Handlebars.registerHelper("convertTypeToRbs", convertTypeToRbs);

(async () => {
Expand Down Expand Up @@ -424,10 +433,15 @@ module LanguageServer
#
{{/if}}
class {{definition.interface.name}}
def initialize: ({{method_signature definition.allMembers}}) -> void
def initialize: ({{constructor_signature definition.allMembers}}) -> void

@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]
{{#each definition.allMembers}}

%a{pure}
def {{snake name}}: () -> {{attribute_signature this}}
{{/each}}

def to_hash: () -> Hash[Symbol, untyped]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def range: () -> untyped

%a{pure}
def new_text: () -> String

%a{pure}
def annotation_id: () -> String

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def label: () -> String?

%a{pure}
def edit: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def applied: () -> bool

%a{pure}
def failure_reason: () -> String?

%a{pure}
def failed_change: () -> Integer?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def dynamic_registration: () -> bool?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def from: () -> untyped

%a{pure}
def from_ranges: () -> Array[untyped]

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def work_done_token: () -> untyped

%a{pure}
def partial_result_token: () -> untyped

%a{pure}
def item: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
24 changes: 24 additions & 0 deletions sig/language_server/protocol/interface/call_hierarchy_item.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def name: () -> String

%a{pure}
def kind: () -> untyped

%a{pure}
def tags: () -> Array[untyped]?

%a{pure}
def detail: () -> String?

%a{pure}
def uri: () -> String

%a{pure}
def range: () -> untyped

%a{pure}
def selection_range: () -> untyped

%a{pure}
def data: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def work_done_progress: () -> bool?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def to: () -> untyped

%a{pure}
def from_ranges: () -> Array[untyped]

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def work_done_token: () -> untyped

%a{pure}
def partial_result_token: () -> untyped

%a{pure}
def item: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def text_document: () -> untyped

%a{pure}
def position: () -> untyped

%a{pure}
def work_done_token: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def document_selector: () -> untyped

%a{pure}
def work_done_progress: () -> bool?

%a{pure}
def id: () -> String?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
3 changes: 3 additions & 0 deletions sig/language_server/protocol/interface/cancel_params.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def id: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
9 changes: 9 additions & 0 deletions sig/language_server/protocol/interface/change_annotation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def label: () -> String

%a{pure}
def needs_confirmation: () -> bool?

%a{pure}
def description: () -> String?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
18 changes: 18 additions & 0 deletions sig/language_server/protocol/interface/client_capabilities.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def workspace: () -> untyped

%a{pure}
def text_document: () -> untyped

%a{pure}
def notebook_document: () -> untyped

%a{pure}
def window: () -> untyped

%a{pure}
def general: () -> untyped

%a{pure}
def experimental: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
24 changes: 24 additions & 0 deletions sig/language_server/protocol/interface/code_action.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def title: () -> String

%a{pure}
def kind: () -> String?

%a{pure}
def diagnostics: () -> Array[untyped]?

%a{pure}
def is_preferred: () -> bool?

%a{pure}
def disabled: () -> untyped

%a{pure}
def edit: () -> untyped

%a{pure}
def command: () -> untyped

%a{pure}
def data: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def dynamic_registration: () -> bool?

%a{pure}
def code_action_literal_support: () -> untyped

%a{pure}
def is_preferred_support: () -> bool?

%a{pure}
def disabled_support: () -> bool?

%a{pure}
def data_support: () -> bool?

%a{pure}
def resolve_support: () -> untyped

%a{pure}
def honors_change_annotations: () -> bool?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def diagnostics: () -> Array[untyped]

%a{pure}
def only: () -> Array[String]?

%a{pure}
def trigger_kind: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def work_done_progress: () -> bool?

%a{pure}
def code_action_kinds: () -> Array[String]?

%a{pure}
def resolve_provider: () -> bool?

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
15 changes: 15 additions & 0 deletions sig/language_server/protocol/interface/code_action_params.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ module LanguageServer
@attributes: Hash[Symbol, untyped]
attr_reader attributes: Hash[Symbol, untyped]

%a{pure}
def work_done_token: () -> untyped

%a{pure}
def partial_result_token: () -> untyped

%a{pure}
def text_document: () -> untyped

%a{pure}
def range: () -> untyped

%a{pure}
def context: () -> untyped

def to_hash: () -> Hash[Symbol, untyped]

def to_json: (*untyped) -> String
Expand Down
Loading