Skip to content

Commit

Permalink
Issue #584
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamNaj committed Feb 15, 2016
1 parent 1201681 commit 024c024
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cognifide.PowerShell/Client/Applications/PowerShellIse.cs
Expand Up @@ -833,7 +833,7 @@ protected virtual void UpdateSettings(ClientPipelineArgs args)
: "Monaco, Menlo, \"Ubuntu Mono\", Consolas, source-code-pro, monospace";
var bottomPadding = VersionResolver.IsVersionHigherOrEqual(VersionResolver.SitecoreVersion80) ? 0 : 10;
SheerResponse.Eval(
$"cognifide.powershell.changeResultsSettings('{font}', {settings.FontSize}, '{backgroundColor}', {bottomPadding});");
$"cognifide.powershell.changeSettings('{font}', {settings.FontSize}, '{backgroundColor}', {bottomPadding}, {settings.LiveAutocompletion.ToString().ToLower()});");
}

[HandleMessage("ise:setbreakpoint", true)]
Expand Down
5 changes: 5 additions & 0 deletions Cognifide.PowerShell/Core/Settings/ApplicationSettings.cs
Expand Up @@ -75,6 +75,7 @@ public static string ScriptLibraryDb
public string ApplicationName { get; private set; }
public int FontSize { get; set; }
public string FontFamily { get; set; }
public bool LiveAutocompletion { get; set; }

public string AppSettingsPath
{
Expand Down Expand Up @@ -234,6 +235,7 @@ public void Save()
configuration["LastScript"] = HttpUtility.HtmlEncode(LastScript);
((CheckboxField) configuration.Fields["SaveLastScript"]).Checked = SaveLastScript;
((CheckboxField) configuration.Fields["UseTypeInfo"]).Checked = UseTypeInfo;
((CheckboxField)configuration.Fields["LiveAutocompletion"]).Checked = LiveAutocompletion;
configuration["HostWidth"] = HostWidth.ToString(CultureInfo.InvariantCulture);
configuration["ForegroundColor"] = ForegroundColor.ToString();
configuration["BackgroundColor"] = BackgroundColor.ToString();
Expand All @@ -255,6 +257,8 @@ internal void Load()
LastScript = TryGetSettingValue(() => HttpUtility.HtmlDecode(configuration["LastScript"]), "");
SaveLastScript =
TryGetSettingValue(() => ((CheckboxField) configuration.Fields["SaveLastScript"]).Checked, false);
LiveAutocompletion =
TryGetSettingValue(() => ((CheckboxField)configuration.Fields["LiveAutocompletion"]).Checked, false);
UseTypeInfo = TryGetSettingValue(
() => ((CheckboxField) configuration.Fields["UseTypeInfo"]).Checked,
false);
Expand Down Expand Up @@ -309,6 +313,7 @@ private void SetToDefault()
FontSize = 12;
FontFamily = "Monaco";
Loaded = true;
LiveAutocompletion = false;
}

public static T TryGetSettingValue<T>(Func<T> action, T defaultValue)
Expand Down
Expand Up @@ -20,9 +20,9 @@ people/16x16/cubes_blue.png
field: {CF738220-908D-4C3F-9482-32E625DAF13C}
name: Fields
key: fields
content-length: 88
content-length: 107

FontSize|FontFamily|HostWidth|ForegroundColor|BackgroundColor|UseTypeInfo|SaveLastScript
FontSize|FontFamily|HostWidth|ForegroundColor|BackgroundColor|UseTypeInfo|SaveLastScript|LiveAutocompletion
----field----
field: {BA3F86A2-4A1C-4D78-B63D-91C2779C1B5E}
name: __Sortorder
Expand All @@ -33,7 +33,7 @@ content-length: 3
----version----
language: en
version: 1
revision: a6b57ba3-fa54-4ccf-a75c-4cb8eb9b4111
revision: d5e80a11-709b-4837-b93b-542d7e789147

----field----
field: {108D3A63-BAAA-4560-86D8-3A112ED84717}
Expand Down Expand Up @@ -76,14 +76,14 @@ name: __Revision
key: __revision
content-length: 36

a6b57ba3-fa54-4ccf-a75c-4cb8eb9b4111
d5e80a11-709b-4837-b93b-542d7e789147
----field----
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522}
name: __Updated
key: __updated
content-length: 34
content-length: 15

20150608T181741:635693842618779297
20160215T115435
----field----
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}
name: __Updated by
Expand Down
Expand Up @@ -27,9 +27,9 @@ White
field: {AEEB1BB0-87B9-4E16-B5DE-D4CC544A992F}
name: BackgroundColor
key: backgroundcolor
content-length: 5
content-length: 8

Black
DarkBlue
----field----
field: {89850FAA-2631-4108-B59D-B5A14A818620}
name: UseTypeInfo
Expand All @@ -47,7 +47,7 @@ People/32x32/users1.png
----version----
language: en
version: 1
revision: 38ad7bb7-4cd2-4b9e-84db-ca2f21cf13f3
revision: 105b20e8-35b5-4ba1-a654-aa3bff563243

----field----
field: {86ECC435-0924-4EA0-92D8-CCA12ED7E644}
Expand Down Expand Up @@ -83,14 +83,14 @@ name: __Revision
key: __revision
content-length: 36

38ad7bb7-4cd2-4b9e-84db-ca2f21cf13f3
105b20e8-35b5-4ba1-a654-aa3bff563243
----field----
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522}
name: __Updated
key: __updated
content-length: 15

20160112T141613
20160207T150316
----field----
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}
name: __Updated by
Expand Down
@@ -0,0 +1,65 @@
----item----
version: 1
id: {E81731F2-D79D-4F63-A36D-29502B0DC406}
database: master
path: /sitecore/templates/Modules/PowerShell Console/PowerShell Console Settings/Behaviour/LiveAutocompletion
parent: {86D29DA6-FFAD-4F0E-A659-AAE49F0E4A6B}
name: LiveAutocompletion
master: {00000000-0000-0000-0000-000000000000}
template: {455A3E98-A627-4B40-8035-E683A0331AC7}
templatekey: Template field

----field----
field: {AB162CC0-DC80-4ABF-8871-998EE5D7BA32}
name: Type
key: type
content-length: 8

Checkbox
----field----
field: {BA3F86A2-4A1C-4D78-B63D-91C2779C1B5E}
name: __Sortorder
key: __sortorder
content-length: 3

400
----version----
language: en
version: 1
revision: 0d447332-f4b0-4862-a8ee-829d85aa302e

----field----
field: {19A69332-A23E-4E70-8D16-B2640CB24CC8}
name: Title
key: title
content-length: 160

Live Auto-complete - when I type one of the following characters: "\" or "-" auto-complete should trigger automatically (can cause editor to freeze temporarily)
----field----
field: {25BED78C-4957-4165-998A-CA1B52F67497}
name: __Created
key: __created
content-length: 15

20160215T114258
----field----
field: {8CDC337E-A112-42FB-BBB4-4143751E123F}
name: __Revision
key: __revision
content-length: 36

0d447332-f4b0-4862-a8ee-829d85aa302e
----field----
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522}
name: __Updated
key: __updated
content-length: 15

20160215T115401
----field----
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}
name: __Updated by
key: __updated by
content-length: 14

sitecore\admin
14 changes: 11 additions & 3 deletions Cognifide.PowerShell/sitecore modules/PowerShell/Scripts/ise.js
Expand Up @@ -114,8 +114,7 @@
ace.config.loadModule("ace/ext/language_tools", function(module) {
codeeditor.setOptions({
enableSnippets: true,
enableBasicAutocompletion: true,
enableLiveAutocompletion: true
enableBasicAutocompletion: true
});

var keyWordCompleter = {
Expand Down Expand Up @@ -305,6 +304,12 @@
$("#ScriptResult").css({ "font-size": setting + "px" });
};

cognifide.powershell.changeLiveAutocompletion = function(liveAutocompletion) {
codeeditor.setOptions({
enableLiveAutocompletion: liveAutocompletion
});
};

cognifide.powershell.appendOutput = function(outputToAppend) {
var decoded = $("<div/>").html(outputToAppend).text();
$("#ScriptResultCode").append(decoded);
Expand All @@ -322,10 +327,13 @@
$("#Result").css({ "background-color": setting });
};

cognifide.powershell.changeResultsSettings = function(fontFamily, fontSize, backgroundColor, bottomOffset) {
cognifide.powershell.changeSettings = function(fontFamily, fontSize, backgroundColor, bottomOffset, liveAutocompletion) {
cognifide.powershell.changeBackgroundColor(backgroundColor);
cognifide.powershell.changeFontFamily(fontFamily);
cognifide.powershell.changeFontSize(fontSize);
if (liveAutocompletion !== undefined) {
cognifide.powershell.changeLiveAutocompletion(liveAutocompletion);
}
resultsBottomOffset = bottomOffset;
};

Expand Down

0 comments on commit 024c024

Please sign in to comment.