Skip to content

Commit

Permalink
https://github.com/nicollasricas/vscode-streamdeck/issues/2
Browse files Browse the repository at this point in the history
  • Loading branch information
nicollasricas committed Dec 10, 2019
1 parent fa0a7da commit 05fd790
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 64 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.2] - 2019-12-09

### Added

- Change language key

## Changed

- "Execute Command" key now support arguments.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Stream Deck for Visual Studio Code

Enables Stream Deck integration within Visual Studio Code.

## Features

- Execute any Visual Studio Code command.
- Create and execute terminal commands.

## WIP Features

- Advanced terminal creation and command execution with the new released API.
- Support for Stream Deck Multi Actions.
- Folder switch based on the type of project.

## Getting Started

1. Download _Visual Studio Code plugin_ on Stream Deck Store or [here](https://github.com/nicollasricas/vscode-streamdeck/releases).
2. Download _Stream Deck for Visual Studio Code_ on Visual Studio Code marketplace.

## Settings

You can change the IP and port to the message server in:

_%appdata%\Elgato\StreamDeck\Plugins\com.nicollasr.streamdeckvsc.sdPlugin\appsettings.json_

**Don't forget to change it in Visual Studio Code settings or you won't be able to connect and use the available features.**

_I recommend using 127.0.0.1 as your IP address instead of localhost_.

## Getting Commands ID

In Visual Studio Code open _File->Preferences->Keyboard Shortcuts_, find the command you want, right-click it and _Copy Command Id_.
2 changes: 2 additions & 0 deletions StreamDeckVSC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9EE6799E-9A01-4E5E-B696-5922F9ADD366}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CHANGELOG.md = CHANGELOG.md
postbuild.ps1 = postbuild.ps1
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{6840FF3F-FDB4-4185-AE02-AB8B1FFACFF6}"
Expand Down
21 changes: 21 additions & 0 deletions StreamDeckVSC/Keys/ChangeLanguageKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using BarRaider.SdTools;
using StreamDeckVSC.Messages;
using StreamDeckVSC.Settings;

namespace StreamDeckVSC.Keys
{
[PluginActionId("com.nicollasr.streamdeckvsc.changelanguage")]
public class ChangeLanguageKey : KeyBase<ChangeLanguageSettings>
{
public ChangeLanguageKey(SDConnection connection, InitialPayload payload) : base(connection, payload)
{
}

public override void KeyPressed(KeyPayload payload)
{
base.KeyPressed(payload);

MessageServer.CurrentClient?.Send(new ChangeLanguageMessage(settings.LanguageId));
}
}
}
6 changes: 5 additions & 1 deletion StreamDeckVSC/Keys/ExecuteCommandKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public override void KeyPressed(KeyPayload payload)
{
base.KeyPressed(payload);

MessageServer.CurrentClient?.Send(new ExecuteCommandMessage(settings.Command));
MessageServer.CurrentClient?.Send(new ExecuteCommandMessage()
{
Command = settings.Command,
Arguments = settings.Arguments
});
}
}
}
21 changes: 21 additions & 0 deletions StreamDeckVSC/Messages/ChangeLanguageMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace StreamDeckVSC.Messages
{
public class ChangeLanguageMessage
{
[JsonProperty("languageId")]
public string LanguageId { get; set; }

public ChangeLanguageMessage()
{
}

public ChangeLanguageMessage(string languageId) => LanguageId = languageId;
}
}
4 changes: 2 additions & 2 deletions StreamDeckVSC/Messages/ExecuteCommandMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class ExecuteCommandMessage
[JsonProperty("command")]
public string Command { get; set; }

//[JsonProperty("arguments")]
//public string Arguments { get; set; }
[JsonProperty("arguments")]
public string Arguments { get; set; }

public ExecuteCommandMessage()
{
Expand Down
44 changes: 44 additions & 0 deletions StreamDeckVSC/PropertyInspector/ChangeLanguage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>com.streamdeck-vscode.terminal Property Inspector</title>
<link rel="stylesheet" href="css/sdpi.css" />
<script src="js/pi.js"></script>
</head>
<body>
<div class="sdpi-wrapper">
<details>
<summary>REQUIREMENTS</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode marketplace.
</p>
<a href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck" target="blank">
Download "Stream Deck for Visual Studio Code"
</a>
<a href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank">
How to install extensions
</a>
</details>

<div class="sdpi-item">
<div class="sdpi-item-label">Language ID</div>
<input class="sdpi-item-value" type="text" id="languageId" value="" />
</div>

<div class="sdpi-item">
<a href="https://code.visualstudio.com/docs/languages/identifiers" target="blank">
Language Identifiers
</a>
</div>
</div>

<div class="sdpi-info-label hidden" style="top: -1000;" value=""></div>
</body>
</html>
31 changes: 12 additions & 19 deletions StreamDeckVSC/PropertyInspector/CreateTerminal.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,18 @@
</head>
<body>
<div class="sdpi-wrapper">
<div class="sdpi-item">
<details class="message question">
<summary>Requirements (click to expand)</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode
marketplace.
</p>
<a
class="info"
href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck"
target="blank"
>
Download "Stream Deck for Visual Studio Code"
</a>
<a class="info" href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank"
>How to install extensions</a
>
</details>
</div>
<details>
<summary>REQUIREMENTS</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode marketplace.
</p>
<a href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck" target="blank">
Download "Stream Deck for Visual Studio Code"
</a>
<a href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank">
How to install extensions
</a>
</details>

<div class="sdpi-item">
<div class="sdpi-item-label">Name</div>
Expand Down
37 changes: 18 additions & 19 deletions StreamDeckVSC/PropertyInspector/ExecuteCommand.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,30 @@
</head>
<body>
<div class="sdpi-wrapper">
<div class="sdpi-item">
<details class="message question">
<summary>Requirements (click to expand)</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode
marketplace.
</p>
<a
class="info"
href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck"
target="blank"
>
Download "Stream Deck for Visual Studio Code"
</a>
<a class="info" href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank"
>How to install extensions</a
>
</details>
</div>
<details>
<summary>REQUIREMENTS</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode marketplace.
</p>
<a href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck" target="blank">
Download "Stream Deck for Visual Studio Code"
</a>
<a href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank">
How to install extensions
</a>
</details>

<div class="sdpi-item">
<div class="sdpi-item-label">Command (ID)</div>
<input class="sdpi-item-value" type="text" id="command" value="" />
</div>

<div class="sdpi-item">
<div class="sdpi-item-label">Arguments (JSON)</div>
<textarea class="sdpi-item-value" rows="4" id="arguments"></textarea>
{ "snippet": "💄" }
</div>

<div class="sdpi-item alignTop">
<div class="sdpi-item-label empty"></div>
<details open class="noInnerMargins">
Expand Down
31 changes: 12 additions & 19 deletions StreamDeckVSC/PropertyInspector/ExecuteTerminalCommand.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,18 @@
</head>
<body>
<div class="sdpi-wrapper">
<div class="sdpi-item">
<details class="message question">
<summary>Requirements (click to expand)</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode
marketplace.
</p>
<a
class="info"
href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck"
target="blank"
>
Download "Stream Deck for Visual Studio Code"
</a>
<a class="info" href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank"
>How to install extensions</a
>
</details>
</div>
<details>
<summary>REQUIREMENTS</summary>
<p>
For this plugin to work you need to install "Stream Deck for Visual Studio Code" from your vscode marketplace.
</p>
<a href="https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck" target="blank">
Download "Stream Deck for Visual Studio Code"
</a>
<a href="https://code.visualstudio.com/docs/editor/extension-gallery" target="blank">
How to install extensions
</a>
</details>

<div class="sdpi-item">
<div class="sdpi-item-label">Command</div>
Expand Down
2 changes: 1 addition & 1 deletion StreamDeckVSC/PropertyInspector/js/pi.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function registerChangeDetection() {

function getInputs() {
return Array.from(document.querySelectorAll(".sdpi-item-value")).map(element => {
if (element.tagName !== "INPUT") {
if (element.tagName !== "INPUT" && element.tagName !== "TEXTAREA") {
return element.querySelector("input");
}

Expand Down
10 changes: 10 additions & 0 deletions StreamDeckVSC/Settings/ChangeLanguageSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace StreamDeckVSC.Settings
{
public class ChangeLanguageSettings : KeySettings
{
[JsonProperty("languageId")]
public string LanguageId { get; set; }
}
}
4 changes: 2 additions & 2 deletions StreamDeckVSC/Settings/ExecuteCommandSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ExecuteCommandSettings : KeySettings
[JsonProperty("command")]
public string Command { get; set; }

//[JsonProperty("arguments")]
//public string Arguments { get; set; }
[JsonProperty("arguments")]
public string Arguments { get; set; }
}
}
3 changes: 3 additions & 0 deletions StreamDeckVSC/StreamDeckVSC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<None Update="Images\VisualStudioCode.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="PropertyInspector\ChangeLanguage.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="PropertyInspector\ExecuteCommand.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
15 changes: 14 additions & 1 deletion StreamDeckVSC/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
"PropertyInspectorPath": "PropertyInspector/ExecuteCommand.html",
"UUID": "com.nicollasr.streamdeckvsc.executecommand"
},
{
"Icon": "Images/VisualStudioCode",
"Name": "Change Language",
"States": [
{
"Image": "Images/VisualStudioCode"
}
],
"Tooltip": "Change the language that is associated with the given document.",
"SupportedInMultiActions": false,
"PropertyInspectorPath": "PropertyInspector/ChangeLanguage.html",
"UUID": "com.nicollasr.streamdeckvsc.changelanguage"
},
{
"Icon": "Images/VisualStudioCode",
"Name": "Create Terminal",
Expand Down Expand Up @@ -49,7 +62,7 @@
"Category": "Visual Studio Code",
"CategoryIcon": "Images/VisualStudioCode",
"URL": "https://github.com/nicollasricas/streamdeckvsc",
"Version": "1.0.2",
"Version": "2.0.2",
"OS": [
{
"Platform": "windows",
Expand Down
Binary file modified com.nicollasr.streamdeckvsc.streamDeckPlugin
Binary file not shown.

0 comments on commit 05fd790

Please sign in to comment.