Skip to content

Commit

Permalink
Merge pull request #2744 from keesschollaart81/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Jul 19, 2023
2 parents ab72ab9 + f0d483d commit d4e62c9
Show file tree
Hide file tree
Showing 25 changed files with 522 additions and 466 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions-language-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3

- name: 🏗 Set up NodeJS
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: "16"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-actions-vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v3

- name: 🏗 Set up NodeJS
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: "16"

Expand Down
208 changes: 110 additions & 98 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-home-assistant",
"displayName": "Home Assistant Config Helper",
"description": " Completion for entity-id's in Home Assistant Configurations",
"version": "1.36.0",
"version": "1.37.0",
"preview": false,
"engines": {
"vscode": "^1.45.1"
Expand Down Expand Up @@ -427,27 +427,27 @@
},
"devDependencies": {
"@types/mocha": "10.0.1",
"@types/node": "16.18.31",
"@types/node": "20.4.2",
"@types/request": "2.48.8",
"@types/vscode": "1.45.1",
"@types/ws": "8.5.4",
"@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.8.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"rimraf": "5.0.1",
"ts-loader": "^9.4.2",
"ts-loader": "^9.4.3",
"ts-node": "10.9.1",
"typescript": "^5.0.4",
"typescript-json-schema": "0.56.0"
"typescript": "^5.1.3",
"typescript-json-schema": "0.59.0"
},
"dependencies": {
"axios": "^1.4.0",
"bufferutil": "^4.0.7",
"home-assistant-js-websocket": "^8.0.1",
"home-assistant-js-websocket": "^8.2.0",
"utf-8-validate": "^6.0.3",
"vscode-extension-telemetry": "0.4.5",
"vscode-json-languageservice": "3.9.1",
Expand Down
96 changes: 48 additions & 48 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TelemetryReporter from "vscode-extension-telemetry";

const extensionId = "vscode-home-assistant";
const telemetryVersion = generateVersionString(
vscode.extensions.getExtension(`keesschollaart.${extensionId}`)
vscode.extensions.getExtension(`keesschollaart.${extensionId}`),
);

let reporter: TelemetryReporter;
Expand All @@ -22,14 +22,14 @@ const documentSelector = [
];

export async function activate(
context: vscode.ExtensionContext
context: vscode.ExtensionContext,
): Promise<void> {
console.log("Home Assistant Extension has been activated!");

reporter = new TelemetryReporter(
extensionId,
telemetryVersion,
"ff172110-5bb2-4041-9f31-e157f1efda56"
"ff172110-5bb2-4041-9f31-e157f1efda56",
);

try {
Expand All @@ -43,7 +43,7 @@ export async function activate(
context.extensionPath,
"out",
"server",
"server.js"
"server.js",
);

const debugOptions = { execArgv: ["--nolazy", "--inspect=6003"] };
Expand All @@ -69,7 +69,7 @@ export async function activate(
"home-assistant",
"Home Assistant Language Server",
serverOptions,
clientOptions
clientOptions,
);

// is this really needed?
Expand All @@ -87,30 +87,30 @@ export async function activate(
const goToSettings = "Go to Settings (UI)";
const optionClicked = await vscode.window.showInformationMessage(
"Please configure Home Assistant (search for 'Home Assistant' in settings).",
goToSettings
goToSettings,
);
if (optionClicked === goToSettings) {
await vscode.commands.executeCommand(
"workbench.action.openSettings2"
"workbench.action.openSettings2",
);
}
});
client.onNotification("configuration_check_completed", async (result) => {
if (result && result.result === "valid") {
await vscode.window.showInformationMessage(
"Home Assistant Configuration Checked, result: 'Valid'!"
"Home Assistant Configuration Checked, result: 'Valid'!",
);
} else {
await vscode.window.showErrorMessage(
`Home Assistant Configuration check resulted in an error: ${result.error}`
`Home Assistant Configuration check resulted in an error: ${result.error}`,
);
}
});
let haOutputChannel: vscode.OutputChannel;
client.onNotification("get_eror_log_completed", (result) => {
if (!haOutputChannel) {
haOutputChannel = vscode.window.createOutputChannel(
"Home Assistant Error Log"
"Home Assistant Error Log",
);
}
haOutputChannel.appendLine(result);
Expand All @@ -121,7 +121,7 @@ export async function activate(
client.onNotification("render_template_completed", (result) => {
if (!haTemplateRendererChannel) {
haTemplateRendererChannel = vscode.window.createOutputChannel(
"Home Assistant Template Renderer"
"Home Assistant Template Renderer",
);
}
haTemplateRendererChannel.clear();
Expand All @@ -140,131 +140,131 @@ export async function activate(
new CommandMappings(
"vscode-home-assistant.reloadAll",
"homeassistant",
"reload_all"
"reload_all",
),
new CommandMappings(
"vscode-home-assistant.scriptReload",
"script",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.groupReload", "group", "reload"),
new CommandMappings(
"vscode-home-assistant.homeassistantReloadCoreConfig",
"homeassistant",
"reload_core_config"
"reload_core_config",
),
new CommandMappings(
"vscode-home-assistant.homeassistantRestart",
"homeassistant",
"restart"
"restart",
),
new CommandMappings(
"vscode-home-assistant.automationReload",
"automation",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.conversationReload",
"conversation",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.sceneReload", "scene", "reload"),
new CommandMappings(
"vscode-home-assistant.themeReload",
"frontend",
"reload_themes"
"reload_themes",
),
new CommandMappings(
"vscode-home-assistant.homekitReload",
"homekit",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.filesizeReload",
"filesize",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.minMaxReload",
"min_max",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.genericThermostatReload",
"generic_thermostat",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.genericCameraReload",
"generic",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.pingReload", "ping", "reload"),
new CommandMappings("vscode-home-assistant.trendReload", "trend", "reload"),
new CommandMappings(
"vscode-home-assistant.historyStatsReload",
"history_stats",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.universalReload",
"universal",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.statisticsReload",
"statistics",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.filterReload",
"filter",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.restReload", "rest", "reload"),
new CommandMappings(
"vscode-home-assistant.commandLineReload",
"command_line",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.bayesianReload",
"bayesian",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.telegramReload",
"telegram",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.smtpReload", "smtp", "reload"),
new CommandMappings("vscode-home-assistant.mqttReload", "mqtt", "reload"),
new CommandMappings(
"vscode-home-assistant.rpioGpioReload",
"rpi_gpio",
"reload"
"reload",
),
new CommandMappings("vscode-home-assistant.knxReload", "knx", "reload"),
new CommandMappings(
"vscode-home-assistant.templateReload",
"template",
"reload"
"reload",
),
new CommandMappings(
"vscode-home-assistant.customTemplatesReload",
"homeassistant",
"reload_custom_templates"
"reload_custom_templates",
),
new CommandMappings(
"vscode-home-assistant.hassioAddonRestartGitPull",
"hassio",
"addon_restart",
{ addon: "core_git_pull" }
{ addon: "core_git_pull" },
),
new CommandMappings(
"vscode-home-assistant.hassioHostReboot",
"hassio",
"host_reboot"
"host_reboot",
),
];

Expand All @@ -277,9 +277,9 @@ export async function activate(
serviceData: mapping.serviceData,
});
await vscode.window.showInformationMessage(
`Home Assistant service ${mapping.domain}.${mapping.service} called!`
`Home Assistant service ${mapping.domain}.${mapping.service} called!`,
);
})
}),
);
});

Expand All @@ -302,30 +302,30 @@ export async function activate(
domain,
service: "reload",
});
})
}),
);
await vscode.window.showInformationMessage(
"Home Assistant inputs reload called!"
"Home Assistant inputs reload called!",
);
}
)
},
),
);

context.subscriptions.push(
vscode.commands.registerCommand(
"vscode-home-assistant.homeassistantCheckConfig",
async () => {
await client.sendRequest("checkConfig");
}
)
},
),
);
context.subscriptions.push(
vscode.commands.registerCommand(
"vscode-home-assistant.getErrorLog",
async () => {
await client.sendRequest("getErrorLog");
}
)
},
),
);

context.subscriptions.push(
Expand All @@ -335,8 +335,8 @@ export async function activate(
const editor = vscode.window.activeTextEditor;
const selectedText = editor.document.getText(editor.selection);
await client.sendRequest("renderTemplate", { template: selectedText });
}
)
},
),
);

const fileAssociations = vscode.workspace
Expand Down Expand Up @@ -375,6 +375,6 @@ export class CommandMappings {
public service: string,
public serviceData?: {
[key: string]: any;
}
},
) {}
}
Loading

0 comments on commit d4e62c9

Please sign in to comment.