Skip to content

Commit

Permalink
remove unsupported settings (#7982)
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaHuang95 authored Aug 22, 2024
1 parent 016dd48 commit e19e852
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 351 deletions.
2 changes: 1 addition & 1 deletion Build/debugpy-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.2
1.8.5
1 change: 1 addition & 0 deletions Python/Product/PythonTools/PythonTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@
</EmbeddedResource>
<EmbeddedResource Include="PythonTools\Options\PythonInteractiveOptionsControl.resx">
<DependentUpon>PythonInteractiveOptionsControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PythonTools\Project\DefaultPythonLauncherOptions.resx">
<DependentUpon>DefaultPythonLauncherOptions.cs</DependentUpon>
Expand Down
4 changes: 0 additions & 4 deletions Python/Product/PythonTools/PythonTools/DiagnosticsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,11 @@ public void WriteLog(TextWriter writer, bool includeAnalysisLog) {
writer.WriteLine();

writer.WriteLine("Interactive Options:");
writer.WriteLine(" CompletionMode: {0}", pyService.InteractiveOptions.CompletionMode);
writer.WriteLine(" LiveCompletionsOnly: {0}", pyService.InteractiveOptions.LiveCompletionsOnly);
writer.WriteLine(" Scripts: {0}", pyService.InteractiveOptions.Scripts);
writer.WriteLine(" UseSmartHistory: {0}", pyService.InteractiveOptions.UseSmartHistory);
writer.WriteLine();

writer.WriteLine("Debug Interactive Options:");
writer.WriteLine(" CompletionMode: {0}", pyService.DebugInteractiveOptions.CompletionMode);
writer.WriteLine(" LiveCompletionsOnly: {0}", pyService.DebugInteractiveOptions.LiveCompletionsOnly);
writer.WriteLine(" Scripts: {0}", pyService.DebugInteractiveOptions.Scripts);
writer.WriteLine(" UseSmartHistory: {0}", pyService.DebugInteractiveOptions.UseSmartHistory);
writer.WriteLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ bool UseSmartHistory {
set;
}

string CompletionMode {
get;
set;
}

string StartupScripts {
get;
set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,67 +22,47 @@ namespace Microsoft.PythonTools.Options {
/// Stores options related to the all interactive windows.
/// </summary>
class PythonInteractiveOptions {
private bool _smartHistory, _liveCompletionsOnly;
private ReplIntellisenseMode _completionMode;
private bool _smartHistory;
private string _scripts;

private readonly PythonToolsService _pyService;
private readonly string _category;

private const string CompletionModeSetting = "CompletionMode";
private const string UseSmartHistorySetting = "UseSmartHistory";
private const string LiveCompletionsOnlySetting = "LiveCompletionsOnly";
private const string ScriptsSetting = "Scripts";

internal PythonInteractiveOptions(PythonToolsService pyService, string category) {
_pyService = pyService;
_category = category;
_completionMode = ReplIntellisenseMode.DontEvaluateCalls;
_smartHistory = true;
_scripts = string.Empty;
Load();
}

internal ReplIntellisenseMode CompletionMode {
get { return _completionMode; }
set { _completionMode = value; }
}

public bool UseSmartHistory {
get { return _smartHistory; }
set { _smartHistory = value; }
}

public bool LiveCompletionsOnly {
get { return _liveCompletionsOnly; }
set { _liveCompletionsOnly = value; }
}

public string Scripts {
get { return _scripts; }
set { _scripts = value ?? string.Empty; }
}

public void Load() {
CompletionMode = _pyService.LoadEnum<ReplIntellisenseMode>(CompletionModeSetting, _category) ?? ReplIntellisenseMode.DontEvaluateCalls;
UseSmartHistory = _pyService.LoadBool(UseSmartHistorySetting, _category) ?? true;
LiveCompletionsOnly = _pyService.LoadBool(LiveCompletionsOnlySetting, _category) ?? false;
Scripts = _pyService.LoadString(ScriptsSetting, _category) ?? string.Empty;
Changed?.Invoke(this, EventArgs.Empty);
}

public void Save() {
_pyService.SaveEnum(CompletionModeSetting, _category, CompletionMode);
_pyService.SaveBool(UseSmartHistorySetting, _category, UseSmartHistory);
_pyService.SaveBool(LiveCompletionsOnlySetting, _category, LiveCompletionsOnly);
_pyService.SaveString(ScriptsSetting, _category, Scripts);
Changed?.Invoke(this, EventArgs.Empty);
}

public void Reset() {
CompletionMode = ReplIntellisenseMode.DontEvaluateCalls;
UseSmartHistory = true;
LiveCompletionsOnly = false;
Scripts = string.Empty;
Changed?.Invoke(this, EventArgs.Empty);
}
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 @@ -41,10 +41,6 @@ internal async void UpdateSettings() {
try {
scriptsTextBox.Text = _options.Scripts;
useSmartHistoryCheckBox.Checked = _options.UseSmartHistory;
neverEvaluateButton.Checked = _options.CompletionMode == Repl.ReplIntellisenseMode.NeverEvaluate;
evaluateNoCallsButton.Checked = _options.CompletionMode == Repl.ReplIntellisenseMode.DontEvaluateCalls;
alwaysEvaluateButton.Checked = _options.CompletionMode == Repl.ReplIntellisenseMode.AlwaysEvaluate;
liveCompletionsOnlyCheckBox.Checked = _options.LiveCompletionsOnly;
} finally {
_changing = false;
}
Expand All @@ -62,21 +58,6 @@ private void UseSmartHistory_CheckedChanged(object sender, EventArgs e) {
}
}

private void CompletionMode_CheckedChanged(object sender, EventArgs e) {
if (!_changing) {
_options.CompletionMode =
neverEvaluateButton.Checked ? Repl.ReplIntellisenseMode.NeverEvaluate :
evaluateNoCallsButton.Checked ? Repl.ReplIntellisenseMode.DontEvaluateCalls :
Repl.ReplIntellisenseMode.AlwaysEvaluate;
}
}

private void LiveCompletionsOnly_CheckedChanged(object sender, EventArgs e) {
if (!_changing) {
_options.LiveCompletionsOnly = ((CheckBox)sender).Checked;
}
}

private void browseScriptsButton_Click(object sender, EventArgs e) {
var newPath = _serviceProvider.BrowseForDirectory(Handle, _options.Scripts);
if (!string.IsNullOrEmpty(newPath)) {
Expand Down
Loading

0 comments on commit e19e852

Please sign in to comment.