Skip to content

Commit

Permalink
Fix intellisense not showing types properly, vscode extension name
Browse files Browse the repository at this point in the history
  • Loading branch information
DvvCz committed Aug 30, 2023
1 parent 3711f21 commit 4034691
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions packages/ramattra-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { FUNCTIONS, CONSTANTS, EVENTS } from "./compiler/std.js";

export { parse } from "./compiler/parser.js";
export type { Error } from "./compiler/parser.js";

export { parse, type Error } from "./compiler/parser.js";
export { assemble } from "./compiler/assembler.js";
export { analyze } from "./compiler/analyzer.js";
export { analyze } from "./compiler/analyzer.js";
export { reprType, type Type } from "./compiler/typing.js";
18 changes: 9 additions & 9 deletions packages/ramattra-language-server/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FUNCTIONS, analyze, type Error, CONSTANTS, EVENTS } from "@ramattra/ramattra-core";
import { FUNCTIONS, analyze, type Error, CONSTANTS, EVENTS, reprType } from "@ramattra/ramattra-core";
import { dedent } from "@ramattra/ramattra-util";
import { CompletionItemKind, Connection, Diagnostic, DiagnosticSeverity, TextDocuments, TextDocumentSyncKind } from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
Expand Down Expand Up @@ -89,7 +89,7 @@ export const onInit = (connection: Connection) => {
contents: {
kind: "markdown",
value: dedent`
${word}(${fn?.args.map(x => x.default ? `${x.type} = ${x.default}` : x.type).join(", ")})
${word}(${fn?.args.map(x => x.default ? `${reprType(x.type)} = ${x.default}` : reprType(x.type)).join(", ")})
**Overwatch Function**: \`${fn.ow}\`
[workshop.codes](${WORKSHOP_CODES_HREF}${fn.ow.replaceAll(" ", "+").toLowerCase()})
Expand All @@ -102,7 +102,7 @@ export const onInit = (connection: Connection) => {
contents: {
kind: "markdown",
value: dedent`
${word}: ${constant.type}
${word}: ${reprType(constant.type)}
**Overwatch Value**: \`${constant.ow}\`
`
Expand All @@ -114,14 +114,14 @@ export const onInit = (connection: Connection) => {
contents: {
kind: "markdown",
value: dedent`
event ${word}(${event.args.map(a => a.type).join(", ")})
event ${word}(${event.args.map(a => reprType(a.type)).join(", ")})
**Overwatch Event**: \`${event.ow}\`
[workshop.codes](${WORKSHOP_CODES_HREF}${event.ow.replaceAll(" ", "+").toLowerCase()})
### Arguments
%S
`.replace("%S", event.args.map(a => `* **${a.ow}**: \`${a.type}\``).join("\n"))
`.replace("%S", event.args.map(a => `* **${a.ow}**: \`${reprType(a.type)}\``).join("\n"))
},
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export const onInit = (connection: Connection) => {
const data = item.data as [CompletionItemKind, string];
if (data[0] == CompletionItemKind.Function) {
const fn = FUNCTIONS[data[1]]!;
item.detail = `${data[1]}(${fn?.args.map(x => x.default ? `${x.type} = ${x.default}` : x.type).join(", ")})`
item.detail = `${data[1]}(${fn?.args.map(x => x.default ? `${reprType(x.type)} = ${x.default}` : reprType(x.type)).join(", ")})`
item.documentation = {
kind: "markdown",
value: dedent`
Expand All @@ -171,7 +171,7 @@ export const onInit = (connection: Connection) => {
}
} else if (data[0] == CompletionItemKind.Constant) {
const constant = CONSTANTS[data[1]]!;
item.detail = `${data[1]}: ${constant.type}`;
item.detail = `${data[1]}: ${reprType(constant.type)}`;
item.documentation = {
kind: "markdown",
value: dedent`
Expand All @@ -180,7 +180,7 @@ export const onInit = (connection: Connection) => {
}
} else if (data[0] == CompletionItemKind.Event) {
const event = EVENTS[data[1]]!;
item.detail = `event ${data[1]}(${event.args.map(a => a.type).join(", ")})`
item.detail = `event ${data[1]}(${event.args.map(a => reprType(a.type)).join(", ")})`
item.documentation = {
kind: "markdown",
value: dedent`
Expand All @@ -189,7 +189,7 @@ export const onInit = (connection: Connection) => {
### Arguments
%S
`.replace("%S", event.args.map(a => `* **${a.ow}**: \`${a.type}\``).join("\n"))
`.replace("%S", event.args.map(a => `* **${a.ow}**: \`${reprType(a.type)}\``).join("\n"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ramattra-vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ramattra/ramattra-vscode",
"name": "ramattra-vscode",
"displayName": "Ramattra",
"author": "David Cruz",
"publisher": "dvvcz",
Expand Down

0 comments on commit 4034691

Please sign in to comment.