Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
219e29a
Add conditional ES5 / ES6 settings to IntelliSense options control
mousetraps May 31, 2016
59d055f
refactor NodeLS options into separate control
mousetraps May 31, 2016
ee724e6
Rename NodeLs options control
mousetraps May 31, 2016
5d66388
Add Salsa-specific option to download typings
mousetraps May 31, 2016
cd2910c
add typings infobar
mousetraps Jun 3, 2016
f516b20
only show infobar when for new typings folders
mousetraps Jun 3, 2016
ba3b5a7
remove advanced options header
mousetraps Jun 3, 2016
22d1239
fix intellisense options page layout
mousetraps Jun 3, 2016
6886c30
make intellisense options layout consistent
mousetraps Jun 3, 2016
0ebd577
Add typings acquisition options
mousetraps Jun 5, 2016
8170e5b
add access keys to es6 intellisense options
mousetraps Jun 5, 2016
3285a05
update intellisense options tabindex
mousetraps Jun 6, 2016
c024e20
add typings folder hyperlink, fix auto-dts conditional, remove dead code
mousetraps Jun 6, 2016
43ed92d
auto-dts --save off by default, add option to options page
mousetraps Jun 6, 2016
62242a9
fix intellisense options page layout
mousetraps Jun 6, 2016
a01da06
fix intellisense options layout
mousetraps Jun 6, 2016
5828825
add typings help link to intellisense options page
mousetraps Jun 6, 2016
6abc383
fixed intellisense options page layout
mousetraps Jun 6, 2016
c31f237
modify options text
mousetraps Jun 6, 2016
5b1b37a
cleanup
mousetraps Jun 6, 2016
d67b867
use lazy instead of double-checked locking to encapsulate singleton p…
mousetraps Jun 7, 2016
4baf75b
hide advanced salsa options for DEV15
mousetraps Jun 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add typings acquisition options
  • Loading branch information
mousetraps committed Jun 5, 2016
commit 0ebd577c275e0e0f93b70da8b0663808969a3fc4
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ internal bool ShowCompletionListAfterCharacterTyped {
}
}

internal bool EnableAutomaticTypingsAcquisition { get; set; }
public bool EnableAutomaticTypingsAcquisition { get; set; }

public bool ShowTypingsInfoBar { get; set; }

public event EventHandler<EventArgs> AnalysisLevelChanged;
public event EventHandler<EventArgs> AnalysisLogMaximumChanged;
Expand All @@ -169,6 +171,7 @@ public override void ResetSettings() {
private const string OnlyTabOrEnterToCommitSetting = "OnlyTabOrEnterToCommit";
private const string ShowCompletionListAfterCharacterTypedSetting = "ShowCompletionListAfterCharacterTyped";
private const string EnableAutomaticTypingsAcquisitionSetting = "EnableAutomaticTypingsAcquisition";
private const string ShowTypingsInfoBarSetting = "ShowTypingsInfoBar";

public override void LoadSettingsFromStorage() {
// Load settings from storage.
Expand All @@ -178,6 +181,7 @@ public override void LoadSettingsFromStorage() {
OnlyTabOrEnterToCommit = LoadBool(OnlyTabOrEnterToCommitSetting) ?? true;
ShowCompletionListAfterCharacterTyped = LoadBool(ShowCompletionListAfterCharacterTypedSetting) ?? true;
EnableAutomaticTypingsAcquisition = LoadBool(EnableAutomaticTypingsAcquisitionSetting) ?? true;
ShowTypingsInfoBar = LoadBool(ShowTypingsInfoBarSetting) ?? true;

// Synchronize UI with backing properties.
if (_window != null) {
Expand All @@ -203,6 +207,7 @@ public override void SaveSettingsToStorage() {
SaveBool(OnlyTabOrEnterToCommitSetting, OnlyTabOrEnterToCommit);
SaveBool(ShowCompletionListAfterCharacterTypedSetting, ShowCompletionListAfterCharacterTyped);
SaveBool(EnableAutomaticTypingsAcquisitionSetting, EnableAutomaticTypingsAcquisition);
SaveBool(ShowTypingsInfoBarSetting, ShowTypingsInfoBar);
}

private static string GetTypeScriptToolsVersion() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ public SalsaLsIntellisenseOptionsControl() {

internal void SyncPageWithControlSettings(NodejsIntellisenseOptionsPage page) {
page.EnableAutomaticTypingsAcquisition = _enableAutomaticTypingsAcquisition.Checked;
page.ShowTypingsInfoBar = _showTypingsInfoBar.Checked;
}

internal void SyncControlWithPageSettings(NodejsIntellisenseOptionsPage page) {
_enableAutomaticTypingsAcquisition.Checked = page.EnableAutomaticTypingsAcquisition;
_showTypingsInfoBar.Checked = page.ShowTypingsInfoBar;
}

}
}
21 changes: 12 additions & 9 deletions Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ private void OnIdleNodeModules(object state) {
internal bool ShouldAcquireTypingsAutomatically {
get {
#if DEV14
if (NodejsPackage.Instance.IntellisenseOptionsPage.AnalysisLevel != Options.AnalysisLevel.Preview) {
if (NodejsPackage.Instance.IntellisenseOptionsPage.AnalysisLevel != Options.AnalysisLevel.Preview ||
NodejsPackage.Instance.IntellisenseOptionsPage.EnableAutomaticTypingsAcquisition) {
return false;
}

Expand Down Expand Up @@ -151,11 +152,13 @@ private void TryToAcquireTypings(IEnumerable<string> packages) {
TypingsAcquirer
.AcquireTypings(packages, null /*redirector*/)
.ContinueWith(x => {
if (x.Result && isNewTypingsFolder) {
NodejsPackage.Instance.GetUIThread().Invoke(() => {
TypingsInfoBar.Instance.ShowInfoBar();
});
}
if (NodejsPackage.Instance.IntellisenseOptionsPage.ShowTypingsInfoBar &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future: if the acquisition fails, do we also want to show a message of some kind? Typing acquisition failures will result in an unexpectedly degraded intellisense experience.

Copy link
Copy Markdown
Contributor Author

@mousetraps mousetraps Jun 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's a great idea - at least for when internet connection is lacking or something like that. If we do it lack of availability in definitely typed, i'd be concerned with how frequently it will fail to acquire typings for a newly installed package. We should chat with @bowdenk7, who's been delving into Salsa UX in general.

x.Result &&
isNewTypingsFolder) {
NodejsPackage.Instance.GetUIThread().Invoke(() => {
TypingsInfoBar.Instance.ShowInfoBar();
});
}
});
}
}
Expand Down Expand Up @@ -409,7 +412,7 @@ public override CommonFileNode CreateCodeFileNode(ProjectElement item) {

public override CommonFileNode CreateNonCodeFileNode(ProjectElement item) {
string fileName = item.Url;
if (Path.GetFileName(fileName).Equals(NodejsConstants.PackageJsonFile, StringComparison.OrdinalIgnoreCase) &&
if (Path.GetFileName(fileName).Equals(NodejsConstants.PackageJsonFile, StringComparison.OrdinalIgnoreCase) &&
!fileName.Contains(NodejsConstants.NodeModulesStagingFolder)) {
return new PackageJsonFileNode(this, item);
}
Expand Down Expand Up @@ -735,7 +738,7 @@ protected internal override void ProcessReferences() {
}
}

#region VSWebSite Members
#region VSWebSite Members

// This interface is just implemented so we don't get normal profiling which
// doesn't work with our projects anyway.
Expand Down Expand Up @@ -802,7 +805,7 @@ public VsWebSite.WebServices WebServices {
get { throw new NotImplementedException(); }
}

#endregion
#endregion

Task INodePackageModulesCommands.InstallMissingModulesAsync() {
//Fire off the command to update the missing modules
Expand Down