Exemplo n.º 1
0
 public void Load()
 {
     TypeShedPath     = _pyService.LoadString(nameof(TypeShedPath), Category);
     SuppressTypeShed = _pyService.LoadBool(nameof(SuppressTypeShed), Category) ?? false;
     ServerDisabled   = _pyService.LoadBool(nameof(ServerDisabled), Category) ?? false;
     Changed?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 2
0
        public void Load()
        {
            ShowOutputWindowForVirtualEnvCreate    = _pyService.LoadBool(ShowOutputWindowForVirtualEnvCreateSetting, GeneralCategory) ?? true;
            ShowOutputWindowForPackageInstallation = _pyService.LoadBool(ShowOutputWindowForPackageInstallationSetting, GeneralCategory) ?? true;
            PromptForEnvCreate           = _pyService.LoadBool(PromptForEnvCreateSetting, GeneralCategory) ?? true;
            PromptForPackageInstallation = _pyService.LoadBool(PromptForPackageInstallationSetting, GeneralCategory) ?? true;
            ElevatePip = _pyService.LoadBool(ElevatePipSetting, GeneralCategory) ?? false;
            UnresolvedImportWarning = _pyService.LoadBool(UnresolvedImportWarningSetting, GeneralCategory) ?? true;
            InvalidEncodingWarning  = _pyService.LoadBool(InvalidEncodingWarningSetting, GeneralCategory) ?? true;
            ClearGlobalPythonPath   = _pyService.LoadBool(ClearGlobalPythonPathSetting, GeneralCategory) ?? true;


            AutoAnalyzeStandardLibrary             = _pyService.LoadBool(AutoAnalysisSetting, AdvancedCategory) ?? true;
            IndentationInconsistencySeverity       = _pyService.LoadEnum <Severity>(IndentationInconsistencySeveritySetting, AdvancedCategory) ?? Severity.Warning;
            UpdateSearchPathsWhenAddingLinkedFiles = _pyService.LoadBool(UpdateSearchPathsWhenAddingLinkedFilesSetting, AdvancedCategory) ?? true;
            var analysisLimit = _pyService.LoadString(CrossModuleAnalysisLimitSetting, AdvancedCategory);

            if (analysisLimit == null)
            {
                CrossModuleAnalysisLimit = 1300;    // default analysis limit
            }
            else if (analysisLimit == "-")
            {
                CrossModuleAnalysisLimit = null;
            }
            else
            {
                CrossModuleAnalysisLimit = Convert.ToInt32(analysisLimit);
            }
            Changed?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 3
0
        public void Load()
        {
            var changed = false;

            var completeFunctionParens = _service.LoadBool(CompleteFunctionParensSetting, Category) ?? false;

            if (CompleteFunctionParens != completeFunctionParens)
            {
                CompleteFunctionParens = completeFunctionParens;
                changed = true;
            }

            var autoImportCompletions = _service.LoadBool(AutoImportCompletionsSetting, Category) ?? true;

            if (AutoImportCompletions != autoImportCompletions)
            {
                AutoImportCompletions = autoImportCompletions;
                changed = true;
            }

            if (changed)
            {
                Changed?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 4
0
 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 Load()
 {
     PrimaryPrompt         = _pyService.LoadString(_id + PrimaryPromptSetting, _category) ?? DefaultPrompt;
     SecondaryPrompt       = _pyService.LoadString(_id + SecondaryPromptSetting, _category) ?? DefaultSecondaryPrompt;
     UseInterpreterPrompts = _pyService.LoadBool(_id + UseInterpreterPromptsSetting, _category) ?? true;
     ReplIntellisenseMode  = _pyService.LoadEnum <ReplIntellisenseMode>(_id + ReplIntellisenseModeSetting, _category) ?? ReplIntellisenseMode.DontEvaluateCalls;
     ReplSmartHistory      = _pyService.LoadBool(_id + SmartHistorySetting, _category) ?? true;
     LiveCompletionsOnly   = _pyService.LoadBool(_id + LiveCompletionsOnlySetting, _category) ?? false;
 }
Exemplo n.º 6
0
        public void Load()
        {
            SurveyNewsCheck     = _pyService.LoadEnum <SurveyNewsPolicy>(SurveyNewsCheckSetting, GeneralCategory) ?? SurveyNewsPolicy.CheckOnceWeek;
            SurveyNewsLastCheck = _pyService.LoadDateTime(SurveyNewsLastCheckSetting, GeneralCategory) ?? DateTime.MinValue;
            SurveyNewsFeedUrl   = _pyService.LoadString(SurveyNewsFeedUrlSetting, GeneralCategory) ?? DefaultSurveyNewsFeedUrl;
            SurveyNewsIndexUrl  = _pyService.LoadString(SurveyNewsIndexUrlSetting, GeneralCategory) ?? DefaultSurveyNewsIndexUrl;
            ShowOutputWindowForVirtualEnvCreate    = _pyService.LoadBool(ShowOutputWindowForVirtualEnvCreateSetting, GeneralCategory) ?? true;
            ShowOutputWindowForPackageInstallation = _pyService.LoadBool(ShowOutputWindowForPackageInstallationSetting, GeneralCategory) ?? true;
            ElevatePip              = _pyService.LoadBool(ElevatePipSetting, GeneralCategory) ?? false;
            ElevateEasyInstall      = _pyService.LoadBool(ElevateEasyInstallSetting, GeneralCategory) ?? false;
            UnresolvedImportWarning = _pyService.LoadBool(UnresolvedImportWarningSetting, GeneralCategory) ?? true;
            ClearGlobalPythonPath   = _pyService.LoadBool(ClearGlobalPythonPathSetting, GeneralCategory) ?? true;


            AutoAnalyzeStandardLibrary             = _pyService.LoadBool(AutoAnalysisSetting, AdvancedCategory) ?? true;
            IndentationInconsistencySeverity       = _pyService.LoadEnum <Severity>(IndentationInconsistencySeveritySetting, AdvancedCategory) ?? Severity.Warning;
            UpdateSearchPathsWhenAddingLinkedFiles = _pyService.LoadBool(UpdateSearchPathsWhenAddingLinkedFilesSetting, AdvancedCategory) ?? true;
            var analysisLimit = _pyService.LoadString(CrossModuleAnalysisLimitSetting, AdvancedCategory);

            if (analysisLimit == null)
            {
                CrossModuleAnalysisLimit = 1300;    // default analysis limit
            }
            else if (analysisLimit == "-")
            {
                CrossModuleAnalysisLimit = null;
            }
            else
            {
                CrossModuleAnalysisLimit = Convert.ToInt32(analysisLimit);
            }
            Changed?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 7
0
        public async override Task CheckAsync()
        {
            if (IsCreated)
            {
                return;
            }
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var isTrusted = _pts.LoadBool(_workspace.Location, _trustedWorkspacesCategory);

            if (isTrusted != null)
            {
                _workspace.IsTrusted = isTrusted.Value;
                return;
            }

            var infoBarMessage = new List <IVsInfoBarTextSpan> {
                new InfoBarTextSpan(Strings.UntrustedWorkspaceInfoBarText)
            };
            var actionItems = new List <InfoBarActionItem> {
                new InfoBarHyperlink(Strings.AlwaysTrustWorkspaceInfoBarAction, (Action)(() => Trust(UntrustedWorkspaceInfoBarAction.AlwaysTrust, trust: true, persist: true))),
                new InfoBarHyperlink(Strings.TrustOnceWorkspaceInfoBarAction, (Action)(() => Trust(UntrustedWorkspaceInfoBarAction.TrustOnce, trust: true, persist: false))),
                new InfoBarHyperlink(Strings.DontTrustWorkspaceInfoBarAction, (Action)(() => Trust(UntrustedWorkspaceInfoBarAction.DontTrust, trust: false, persist: false))),
            };

            Logger?.LogEvent(
                PythonLogEvent.UntrustedWorkspaceInfoBar,
                new PythonVersionNotSupportedInfoBarInfo {
                Action = UntrustedWorkspaceInfoBarAction.Prompt,
            }
                );

            Create(new InfoBarModel(infoBarMessage, actionItems, KnownMonikers.StatusSecurityWarning));
        }
Exemplo n.º 8
0
 public void Load()
 {
     EnterCommitsIntellisense        = _service.LoadBool(EnterCommitsSetting, Category) ?? true;
     IntersectMembers                = _service.LoadBool(IntersectMembersSetting, Category) ?? false;
     AddNewLineAtEndOfFullyTypedWord = _service.LoadBool(NewLineAtEndOfWordSetting, Category) ?? false;
     CompletionCommittedBy           = _service.LoadString(CompletionCommittedBySetting, Category) ?? _defaultCompletionChars;
     EnterOutliningModeOnOpen        = _service.LoadBool(EnterOutlingModeOnOpenSetting, Category) ?? true;
     PasteRemovesReplPrompts         = _service.LoadBool(PasteRemovesReplPromptsSetting, Category) ?? true;
     FilterCompletions               = _service.LoadBool(FilterCompletionsSetting, Category) ?? true;
     ColorNames             = _service.LoadBool(ColorNamesSetting, Category) ?? true;
     ColorNamesWithAnalysis = _service.LoadBool(ColorNamesWithAnalysisSetting, Category) ?? true;
     AutoListIdentifiers    = _service.LoadBool(AutoListIdentifiersSetting, Category) ?? true;
     Changed?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 9
0
 public void Load()
 {
     EnterCommitsIntellisense        = _service.LoadBool(EnterCommitsSetting, Category) ?? true;
     IntersectMembers                = _service.LoadBool(IntersectMembersSetting, Category) ?? false;
     AddNewLineAtEndOfFullyTypedWord = _service.LoadBool(NewLineAtEndOfWordSetting, Category) ?? false;
     CompletionCommittedBy           = _service.LoadString("CompletionCommittedBy", Category) ?? _defaultCompletionChars;
     EnterOutliningModeOnOpen        = _service.LoadBool(EnterOutlingModeOnOpenSetting, Category) ?? true;
     PasteRemovesReplPrompts         = _service.LoadBool(PasteRemovesReplPromptsSetting, Category) ?? true;
     FilterCompletions               = _service.LoadBool(FilterCompletionsSetting, Category) ?? true;
     SearchMode             = _service.LoadEnum <FuzzyMatchMode>(SearchModeSetting, Category) ?? FuzzyMatchMode.Default;
     ColorNames             = _service.LoadBool(ColorNamesSetting, Category) ?? true;
     ColorNamesWithAnalysis = _service.LoadBool(ColorNamesWithAnalysisSetting, Category) ?? true;
     AutoListIdentifiers    = _service.LoadBool(AutoListIdentifiersSetting, Category) ?? true;
 }
Exemplo n.º 10
0
 public void Load()
 {
     PromptBeforeRunningWithBuildError = !(_service.LoadBool(DontPromptBeforeRunningWithBuildErrorSetting, Category) ?? false);
     WaitOnAbnormalExit      = _service.LoadBool(WaitOnAbnormalExitSetting, Category) ?? true;
     WaitOnNormalExit        = _service.LoadBool(WaitOnNormalExitSetting, Category) ?? true;
     TeeStandardOutput       = _service.LoadBool(TeeStandardOutSetting, Category) ?? true;
     BreakOnSystemExitZero   = _service.LoadBool(BreakOnSystemExitZeroSetting, Category) ?? false;
     DebugStdLib             = _service.LoadBool(DebugStdLibSetting, Category) ?? false;
     ShowFunctionReturnValue = _service.LoadBool(ShowFunctionReturnValueSetting, Category) ?? true;
     UseLegacyDebugger       = _service.LoadBool(UseLegacyDebuggerSetting, Category) ?? false;
     Changed?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 11
0
 public void Load()
 {
     PromptBeforeRunningWithBuildError = !(_service.LoadBool(DontPromptBeforeRunningWithBuildErrorSetting, Category) ?? false);
     WaitOnAbnormalExit    = _service.LoadBool(WaitOnAbnormalExitSetting, Category) ?? true;
     WaitOnNormalExit      = _service.LoadBool(WaitOnNormalExitSetting, Category) ?? true;
     TeeStandardOutput     = _service.LoadBool(TeeStandardOutSetting, Category) ?? true;
     BreakOnSystemExitZero = _service.LoadBool(BreakOnSystemExitZeroSetting, Category) ?? false;
     DebugStdLib           = _service.LoadBool(DebugStdLibSetting, Category) ?? false;
 }
Exemplo n.º 12
0
        public void Load()
        {
            ShowOutputWindowForVirtualEnvCreate    = _pyService.LoadBool(ShowOutputWindowForVirtualEnvCreateSetting, GeneralCategory) ?? true;
            ShowOutputWindowForPackageInstallation = _pyService.LoadBool(ShowOutputWindowForPackageInstallationSetting, GeneralCategory) ?? true;
            PromptForEnvCreate                 = _pyService.LoadBool(PromptForEnvCreateSetting, GeneralCategory) ?? true;
            PromptForPackageInstallation       = _pyService.LoadBool(PromptForPackageInstallationSetting, GeneralCategory) ?? true;
            PromptForTestFrameWorkInfoBar      = _pyService.LoadBool(PromptForTestFrameWorkInfoBarSetting, GeneralCategory) ?? true;
            PromptForPythonVersionNotSupported = _pyService.LoadBool(PromptForPythonVersionNotSupportedInfoBarSetting, GeneralCategory) ?? true;

            ElevatePip = _pyService.LoadBool(ElevatePipSetting, GeneralCategory) ?? false;

            Changed?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 13
0
        public void Load()
        {
            PromptBeforeRunningWithBuildError = !(_service.LoadBool(DontPromptBeforeRunningWithBuildErrorSetting, Category) ?? false);
            WaitOnAbnormalExit      = _service.LoadBool(WaitOnAbnormalExitSetting, Category) ?? true;
            WaitOnNormalExit        = _service.LoadBool(WaitOnNormalExitSetting, Category) ?? true;
            TeeStandardOutput       = _service.LoadBool(TeeStandardOutSetting, Category) ?? true;
            BreakOnSystemExitZero   = _service.LoadBool(BreakOnSystemExitZeroSetting, Category) ?? false;
            DebugStdLib             = _service.LoadBool(DebugStdLibSetting, Category) ?? false;
            ShowFunctionReturnValue = _service.LoadBool(ShowFunctionReturnValueSetting, Category) ?? true;
            UseLegacyDebugger       = _service.LoadBool(UseLegacyDebuggerSetting, Category) ?? false;

            // variable presentation
            VariablePresentationForClasses   = _service.LoadEnum <PresentationMode>(VariablePresentationForClassesSetting, Category) ?? VariablePresentation.DefaultPresentationMode;
            VariablePresentationForFunctions = _service.LoadEnum <PresentationMode>(VariablePresentationForFunctionsSetting, Category) ?? VariablePresentation.DefaultPresentationMode;
            VariablePresentationForProtected = _service.LoadEnum <PresentationMode>(VariablePresentationForProtectedSetting, Category) ?? VariablePresentation.DefaultPresentationMode;
            VariablePresentationForSpecial   = _service.LoadEnum <PresentationMode>(VariablePresentationForSpecialSetting, Category) ?? VariablePresentation.DefaultPresentationMode;

            Changed?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 14
0
 public void Load()
 {
     PasteRemovesReplPrompts = _service.LoadBool(PasteRemovesReplPromptsSetting, Category) ?? true;
     Formatter = _service.LoadString(FormatterSetting, Category);
     Changed?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 15
0
        public void Load()
        {
            var changed         = false;
            var autoSearchPaths = _service.LoadBool(nameof(AutoSearchPaths), Category) ?? true;

            if (AutoSearchPaths != autoSearchPaths)
            {
                AutoSearchPaths = autoSearchPaths;
                changed         = true;
            }

            var diagnosticMode = _service.LoadString(nameof(DiagnosticMode), Category) ?? PylanceDiagnosticMode.OpenFilesOnly;

            if (DiagnosticMode != diagnosticMode)
            {
                DiagnosticMode = diagnosticMode;
                changed        = true;
            }

            var logLevel = _service.LoadString(nameof(LogLevel), Category) ?? PylanceLogLevel.Information;

            if (LogLevel != logLevel)
            {
                LogLevel = logLevel;
                changed  = true;
            }

            var stubPath = _service.LoadString(nameof(StubPath), Category);

            if (StubPath != stubPath)
            {
                StubPath = stubPath;
                changed  = true;
            }

            var typeCheckingMode = _service.LoadString(nameof(TypeCheckingMode), Category) ?? PylanceTypeCheckingMode.Off;

            if (TypeCheckingMode != typeCheckingMode)
            {
                TypeCheckingMode = typeCheckingMode;
                changed          = true;
            }

            var typeshedPaths = _service.LoadMultilineString(nameof(TypeshedPaths), Category);

            if (!Enumerable.SequenceEqual(TypeshedPaths.MaybeEnumerate(), typeshedPaths.MaybeEnumerate()))
            {
                TypeshedPaths = typeshedPaths;
                changed       = true;
            }

            var extraPaths = _service.LoadMultilineString(nameof(ExtraPaths), Category);

            if (!Enumerable.SequenceEqual(ExtraPaths.MaybeEnumerate(), extraPaths.MaybeEnumerate()))
            {
                ExtraPaths = extraPaths;
                changed    = true;
            }

            var useLibraryCodeForTypes = _service.LoadBool(nameof(UseLibraryCodeForTypes), Category) ?? true;

            if (UseLibraryCodeForTypes != useLibraryCodeForTypes)
            {
                UseLibraryCodeForTypes = useLibraryCodeForTypes;
                changed = true;
            }

            if (changed)
            {
                Changed?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 16
0
 public void Load()
 {
     IncludeAnalysisLogs = _service.LoadBool(IncludeAnalysisLogsSetting, Category) ?? true;
     Changed?.Invoke(this, EventArgs.Empty);
 }