Exemplo n.º 1
0
        internal TaskProviderItem FromUnresolvedImport(
            IServiceProvider serviceProvider,
            IPythonInterpreterFactoryWithDatabase factory,
            string importName,
            SourceSpan span
            )
        {
            string message;

            if (factory != null && !factory.IsCurrent)
            {
                message = SR.GetString(SR.UnresolvedModuleTooltipRefreshing, importName);
            }
            else
            {
                message = SR.GetString(SR.UnresolvedModuleTooltip, importName);
            }

            return(new TaskProviderItem(
                       serviceProvider,
                       message,
                       span,
                       VSTASKPRIORITY.TP_NORMAL,
                       VSTASKCATEGORY.CAT_BUILDCOMPILE,
                       true,
                       _snapshot
                       ));
        }
Exemplo n.º 2
0
        private void TriggerSnippet(uint nCmdID)
        {
            if (_expansionMgr != null)
            {
                string   prompt;
                string[] snippetTypes;
                if ((VSConstants.VSStd2KCmdID)nCmdID == VSConstants.VSStd2KCmdID.SURROUNDWITH)
                {
                    prompt       = SR.GetString(SR.SurroundWith);
                    snippetTypes = _surroundsWithSnippetTypes;
                }
                else
                {
                    prompt       = SR.GetString(SR.InsertSnippet);
                    snippetTypes = _allStandardSnippetTypes;
                }

                _expansionMgr.InvokeInsertionUI(
                    GetViewAdapter(),
                    _expansionClient,
                    GuidList.guidPythonLanguageServiceGuid,
                    snippetTypes,
                    snippetTypes.Length,
                    0,
                    null,
                    0,
                    0,
                    prompt,
                    ">"
                    );
            }
        }
        private void _save_Click(object sender, EventArgs e)
        {
            var path = _provider.BrowseForFileSave(
                Handle,
                "Text Files (*.txt)|*.txt|All Files (*.*)|*.*",
                CommonUtils.GetAbsoluteFilePath(
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                    string.Format("Diagnostic Info {0:yyyy-MM-dd'T'HHmmss}.txt", DateTime.Now)
                    )
                );

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            try {
                TaskDialog.CallWithRetry(
                    _ => File.WriteAllText(path, _textBox.Text),
                    _provider,
                    SR.ProductName,
                    SR.GetString(SR.FailedToSaveDiagnosticInfo),
                    SR.GetString(SR.ErrorDetail),
                    SR.GetString(SR.Retry),
                    SR.GetString(SR.Cancel)
                    );

                Process.Start("explorer.exe", "/select," + ProcessOutput.QuoteSingleArgument(path));
            } catch (OperationCanceledException) {
            }
        }