Git Product home page Git Product logo

rtvs's Introduction

R Tools for Visual Studio

This project is not actively supported.

R Tools is not available in VS 2019. Please see https://docs.microsoft.com/en-us/visualstudio/porting/port-migrate-upgrade-visual-studio-projects-2019?view=vs-2017.

"R Tools for Visual Studio | R Tools for Visual Studio was removed from the Data Science Workload in Visual Studio 2019 Preview. You can continue using Visual Studio 2017 or alternatives like RStudio."

There are also R extensions to VS Code available at the VS Code Marketplace.

Installation

Latests RTVS ships with Visual Studio 2017 as part of the Data Science workload.

Documentation

The interim docs are available here:

Bugs and feature requests

You can submit feedback via VS 2017 feedback tool.

Roadmap

This project is not actively supported.

Builds and pull requests

If you would like to build RTVS yourself, and maybe even make a pull request (highly appreciated!), please take a look at the contributing guidelines first.

Miscellaneous

If you use Python, also check out Python Tools for Visual Studio.

If you want to use RTVS with Azure Machine Learning (e.g. to read and write datasets), have a look at the AzureML R package.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

rtvs's People

Contributors

alexandersher avatar anu-ka avatar capfei avatar crwilcox avatar csigs avatar huguesv avatar ikuyadeu avatar int19h avatar jeongpyoham avatar karthiknadig avatar lordcheeto avatar mikhailarkhipov avatar neil-schneider avatar smortaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtvs's Issues

Error when creating a new project

  • Install vs2015
  • Install RTVS vsix (got some errors due to lack of R)
  • Install R (Got less errors, but File/New project still has issues (sent))

go the error:

rem error

Format Document marks untouched lines yellow (touched)

  1. Type a function in editor and save
  2. Format Document and save
  3. move the opening curly brace of the function (that line in editor indicates touched with yellow color)
  4. save
  5. Format Document

Actual: the whole function body is marked as touched, although only one line is changed

VS hang while typing code

Type the following code in an empty script, one letter at a time. You'll get auto-complete for the parentheses, that's fine. You can auto-complete LETTERS if you want.

After you type the first [, VS will hang.

sum(0:9)
append(LETTERS[1:13],letters[14:26])

NullReferenceException when saving .txt file as .r file

From activity log:

System.NullReferenceException: Object reference not set to an instance of an object.
 at Microsoft.Languages.Editor.Shell.EditorShell.get_CompositionService()
 at Microsoft.R.Editor.QuickInfo.QuickInfoController..ctor(ITextView textView, IList`1 subjectBuffers)
 at Microsoft.R.Editor.QuickInfo.QuickInfoControllerProvider.TryCreateIntellisenseController(ITextView textView, IList`1 subjectBuffers)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.IntellisenseManager.<>c__DisplayClass8_0.<OnGraphBufferContentTypeChange>b__0(IIntellisenseControllerProvider provider)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy`2 provider, Func`2 getter)

Running VS 2015 Community RTM on Windows 7.

Multiple tooltips

It's very easy to get in situations where a tooltip appears twice like this:

double-tooltip

and sometimes one of them gets left behind when you start moving the caret around:

double-tooltip2

Space after "function"

Formatting inserts a space after function, e.g.:

foo <- function (x, y) {
    return (x + y);
}

This is not the standard way to format R code, judging by the standard R library source.

No context menu in editor

If you right click in the editor, there should be a context menu with (at least) Cut/Copy/Paste. Nothing appears.

Doesn't matter whether you have a selection or not.

Killing RHost process freezes REPL window

RHost process pops up with window (That's fine for now during development)

Closing the RHost window and run a command in REPL

Spinning wheel appears to indicate the progress, and it spins forever. VS IDE didn't freeze though.

return() is flagged as an error

I get a squiggly on the closing parenthese when I have

return()

I think it's supposed to be valid, because I'm seeing it used in a few places in R sources.

R host can't load stats.dll

When I start the R Interactive window, I get:

---------------------------
Microsoft.R.Host.exe - System Error
---------------------------
The program can't start because Rlapack.dll is missing from your computer. Try reinstalling the program to fix this problem. 
---------------------------
OK   
---------------------------

Maybe we need to set the R host exe working directory before we start the process.

Error when tabbing code

Start with this code in a R script file:

    while(guess != num)
    {
        guess <- readinteger()
        if (guess == num)
            {
                cat("Congratulations,", num, "is right.\n")
            }
        else if (guess < num)
            {
                cat("It's bigger!\n'")
            }
                else if (guess > num)
                    {
                        cat("It's smaller!\n")
                    }
    }

CTRL-A to select all.
Press SHIFT-TAB.
Press TAB.

Result is an assertion, followed by crash/activity log error.
Assertion:

---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
   at Microsoft.Languages.Editor.Text.TextProvider.GetText(Int32 position, Int32 length) in C:\Projects\GitHub\huguesv\RTVS\src\Languages\Editor\Impl\Text\TextProvider.cs:line 92
   at Microsoft.Languages.Editor.Text.TextProvider.GetText(ITextRange range) in C:\Projects\GitHub\huguesv\RTVS\src\Languages\Editor\Impl\Text\TextProvider.cs:line 98
   at Microsoft.R.Editor.Tree.TextChangeContext.get_OldText() in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\Tree\TextChangeContext.cs:line 75
   at Microsoft.R.Editor.Tree.TextChangeAnalyzer.SafeWhiteSpaceChange(TextChangeContext context, IAstNode node, PositionType positionType) in
C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\Tree\TextChangeAnalyzer.cs:line 49
   at Microsoft.R.Editor.Tree.TextChangeAnalyzer.DetermineChangeType(TextChangeContext change) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\Tree\TextChangeAnalyzer.cs:line 31
   at Microsoft.R.Editor.Tree.TreeUpdateTask.OnTextChanges(IReadOnlyCollection`1 textChanges) in C:\Project......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

Error opening R file in project

---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
R Tools: Editor shell shouldn't be created when quitting the app



   at Microsoft.VisualStudio.R.Package.Shell.AppShell.Initialize()

   at Microsoft.VisualStudio.R.Package.Shell.AppShell.AddRef()

   at Microsoft.VisualStudio.R.Package.Packages.BasePackage`1.Initialize()

   at Microsoft.VisualStudio.R.Packages.R.RPackage.Initialize()

   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)

   at Microsoft.VisualStudio.Shell.Interop.IVsUIShellOpenDocument.OpenStandardEditor(UInt32 grfOpenStandard, String pszMkDocument, Guid& rguidLogicalView, String pszOwnerCaption, IVsUIHierarchy pHier, UInt32 itemid, IntPtr punkDocDataExisting, IServiceProvider psp, IVsWindowFrame& ppWindowFrame)

   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.FileDocumentManager.Open(SimpleHierarchyNode projectItem, Boolean openWith, UInt32 editorFlags, Guid& editorType, String physicalView, Guid& logicalView, IntPtr docDataExisting, IVsWindowFrame......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

More space formatting options

I've turned off all the "Insert space" options and this is the minimal spacing I get after reformatting:

x1 <- runif(8,15,25)
y1 <- 2.5 * x1 - 1.0 + runif(8,-6,6)
points(x1,y1,col = 2)

We should have options to eliminate the remaining whitespace:

  1. assignment operators
  2. binary operators
  3. parameter assignment (all samples I've looked at have no spacing there, but RStudio reformats with spacing)

Another assertion in interactive window

  1. Type:
library(graphics)
  1. Press up arrow
  2. Press down arrow
---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
No editor document available



   at Microsoft.R.Editor.Document.EditorDocument.FromTextBuffer(ITextBuffer textBuffer) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\Document\EditorDocument.cs:line 91

   at Microsoft.R.Editor.SmartIndent.SmartIndenter.GetSmartIndent(ITextSnapshotLine line) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\SmartIndent\SmartIndenter.cs:line 127

   at Microsoft.R.Editor.SmartIndent.SmartIndenter.GetDesiredIndentation(ITextSnapshotLine line, IndentStyle indentStyle) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\SmartIndent\SmartIndenter.cs:line 57

   at Microsoft.R.Editor.SmartIndent.SmartIndenter.GetDesiredIndentation(ITextSnapshotLine line) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\SmartIndent\SmartIndenter.cs:line 44

   at Microsoft.VisualStudio.InteractiveWindow.InteractiveSmartIndenter.GetDesiredIndentation(ITextSnapshotLine line)

   at Microsoft.VisualStudio.Text.Editor.Implementation.SmartIndentationService.GetDesiredIndentation(ITextVie......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

Typing Korean language in edit hangs VS IDE

Repro steps:

  1. create new project
  2. Add script.R file
  3. Change the keyboard to Korean and type something in edit window
  4. VS IDE is not responsive

I used procdump to take full memory dump while IDE hangs. Shared in the link below (780 MB)
\jeongham1\RTVS_BugBash\devenv.exe_150910_103844.dmp

Exception when opening a specific R file

If you open src\library\tools\R\check.R, you'll get this assertion. Ignoring it leads to another one, and the end result is that the file is not opened.

---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------




   at Microsoft.R.Core.AST.Expressions.ExpressionParser.CreateConstant(ParseContext context) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\ExpressionParser.cs:line 480

   at Microsoft.R.Core.AST.Expressions.ExpressionParser.Parse(ParseContext context, IAstNode parent) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\ExpressionParser.cs:line 81

   at Microsoft.R.Core.AST.Expressions.Expression.Parse(ParseContext context, IAstNode parent) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\Expression.cs:line 45

   at Microsoft.R.Core.AST.Statements.ExpressionStatement.Parse(ParseContext context, IAstNode parent) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Statements\ExpressionStatement.cs:line 32

   at Microsoft.R.Core.AST.Scopes.Scope.Parse(ParseContext context, IAstNode parent) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Scopes\Scope.cs:line 101

   at Microsoft.R.Core.AST.AstRoot.Parse(ParseContext context, IAstNode parent......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

Unusual indentation after reformatting if/else statements

The following code

# R Script
while (guess != num) {
    guess <- readinteger()
    if (guess == num) {
        cat("Congratulations,", num, "is right.\n")
    }
    else if (guess < num) {
        cat("It's bigger!\n'")
    }
    else if (guess > num) {
        cat("It's smaller!\n")
    }
}

is reformatted as:

# R Script
while (guess != num) {
    guess <- readinteger()
    if (guess == num) {
        cat("Congratulations,", num, "is right.\n")
    }
    else
        if (guess < num) {
            cat("It's bigger!\n'")
        }
    else
        if (guess > num) {
            cat("It's smaller!\n")
        }
}

Tooltip in interactive window causes assertion, error

When I move the mouse over code in the REPL, I get this assert:

---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
No editor document available



   at Microsoft.R.Editor.Document.EditorDocument.FromTextBuffer(ITextBuffer textBuffer) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\Document\EditorDocument.cs:line 79

   at Microsoft.R.Editor.QuickInfo.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\QuickInfo\QuickInfoSource.cs:line 58

   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()

   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()

   at Microsoft.VisualStudio.Language.Intellisense.Implementation.DefaultQuickInfoController.OnTextView_MouseHover(Object sender, MouseHoverEventArgs e)

   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()

   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.OnHoverTimer(Object sender, EventArgs e)

   at System.Windo......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

Solution explorer doesn't refresh after renaming a file

If you rename an existing file in solution explorer, the file on disk gets renamed, but the tree node is unchanged. The icon shows the file as missing.

Note that this doesn't happen for a fresh instance of VS. I haven't found what the trigger is yet. But working in a project that's been opened for a long time, every rename I'm doing fails to refresh as described above.

I vaguely remember from PTVS/NTVS that file system watchers have a tendency to stop working after a while (too many events?) and that may be the case here.

Edit: A project that I opened 20 mins ago is now reproducing the issue, and I haven't made much changes to it at all. It may just be a matter of leaving it open for a while.

R project template should be listed under "R"

Currently the category is named "R Language", which is inconsistent with every single other language that ships with VS (e.g. it's "Python" and not "Python Language").

This should apply to all other cases where we use the language name anywhere. Similarly, the debug engine / code type should just be named "R" etc.

Unload and Reload project lead to failures

Create new R project
In solution explorer, right-click on R project node and Unload.
Right-click on the project again and Reload.
Notice how the project node doesn't have any children, unlike when it was initially created.
Right-click, Add New Item, R Script

Result:

---------------------------
Microsoft Visual Studio
---------------------------
The project system has encountered an error.



Object reference not set to an instance of an object.



A diagnostic log has been written to the following location: "C:\Users\huvalo\AppData\Local\Temp\VsProjectFault_7ccaaa9b-6370-49e8-9001-a088e30e8aa0.failure.txt".


---------------------------
OK   
---------------------------

which contains:

=====================
9/10/2015 3:32:26 PM
Recoverable
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.ProjectSystem.FileSystemMirroring.Project.FileSystemMirroringProject.<AddTemporaryItems>d__18.MoveNext() in C:\Projects\GitHub\huguesv\RTVS\src\ProjectSystem\Impl\Project\FileSystemMirroringProject.cs:line 130
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.VisualStudio.ProjectSystem.FileSystemMirroring.Project.FileSystemMirroringProjectSourceItemProviderExtensionBase.<AddOwnedSourceItemsAsync>d__7.MoveNext() in C:\Projects\GitHub\huguesv\RTVS\src\ProjectSystem\Impl\Project\FileSystemMirroringProjectSourceItemProviderExtensionBase.cs:line 46
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.SourceItemsService.<AddAsync>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.SourceItemsService.<AddAsync>d__73.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.SourceItemsService.<Microsoft-VisualStudio-ProjectSystem-Items-IProjectItemProvider-AddAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<AddItemWithSpecificAsync>d__564.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.Utilities.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<AddItemWithSpecificAsync>d__564.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProjectItems.<>c__DisplayClass1_0.<<AddFromTemplate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject.<>c__DisplayClass64_0`1.<<Mutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass521_0.<<Mutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ThreadHandlingMultithreaded.ExecuteSynchronously(Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Mutate(Func`1 asyncAction, Boolean includesFileSystemChange)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject.Mutate[T](Func`1 asyncAction, Boolean includesFileSystemChange)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProjectItems.AddFromTemplate(String fileName, String name)
   at Microsoft.VisualStudio.TemplateWizard.Wizard.EnumContentsAddItem(ProjectItems projectItems, XmlNode contentNode, String projectName, String currentFolder, String currentTargetFolder, String rootName, String templateFolderPath, String destinationRootFolderPath, String userSpecifiedDestItemPath, String projectTypeString, List`1 wizardExtensions, String rootExtension)
   at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.RunWizard(SimpleHierarchyNode parentNode, String itemName, String wizardToRun, IntPtr dlgOwner)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<AddItemWithSpecificAsync>d__564.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass428_0.<<AddItem>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ThreadHandlingMultithreaded.ExecuteSynchronously[T](Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass520_0.<HrInvoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.Utilities.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)

Format multiple lines doesn't always respect selection

It's easiest to see this issue if you have 4 lines or more of unformatted code, and select the 2 middle lines by clicking in the margin like this:

format-multi-line-before

Note that line 14 and 15 are selected and the caret is at the start of line 16.

Edit->Advanced->Format Selection

Result is that both lines that were selected are formatted, in addition to the following line, which shouldn't have been formatted.

format-multi-line-after

For comparison, use "Edit->Advanced->Make Uppercase", which correctly only applies formatting to the 2 selected lines.

While it's correct behavior to format the line that the caret is on when there is no selected range, it should not be done when there is a selected range.

Tooltip in editor causes assertion/crash

Put the following code in the text editor:

library(xamlgd)
library(ggplot2)

xaml("ggplot2-ex1.xaml")

# http://www.statmethods.net/advgraphs/ggplot2.html

# create factors with value labels 
mtcars$gear <- factor(mtcars$gear,levels=c(3,4,5),
  labels=c("3gears","4gears","5gears")) 
mtcars$am <- factor(mtcars$am,levels=c(0,1),
  labels=c("Automatic","Manual")) 
mtcars$cyl <- factor(mtcars$cyl,levels=c(4,6,8),
  labels=c("4cyl","6cyl","8cyl")) 

# Kernel density plots for mpg
# grouped by number of gears (indicated by color)
qplot(mpg, data=mtcars, geom="density", fill=gear, alpha=I(.5), 
  main="Distribution of Gas Milage", xlab="Miles Per Gallon", 
  ylab="Density")

Put your mouse cursor over the single space as shown in the picture below.

tooltip-exception

Result:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: length at Microsoft.VisualStudio.Text.Span..ctor(Int32 start, Int32 length) at Microsoft.VisualStudio.Text.Implementation.TextVersion.CreateTrackingSpan(Int32 start, Int32 length, SpanTrackingMode trackingMode) at Microsoft.VisualStudio.Text.Implementation.BaseSnapshot.CreateTrackingSpan(Int32 start, Int32 length, SpanTrackingMode trackingMode) at Microsoft.R.Editor.QuickInfo.QuickInfoSource.AugmentQuickInfoSession(AstRoot ast, Int32 position, IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan, Action`1 retriggerAction) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\QuickInfo\QuickInfoSource.cs:line 80 at Microsoft.R.Editor.QuickInfo.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\QuickInfo\QuickInfoSource.cs:line 64 at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate() at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start() at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoBroker.TriggerQuickInfo(ITextView textView, ITrackingPoint triggerPoint, Boolean trackMouse) at Microsoft.R.Editor.QuickInfo.QuickInfoController.OnViewMouseHover(Object sender, MouseHoverEventArgs e) in C:\Projects\GitHub\huguesv\RTVS\src\R\Editor\Impl\QuickInfo\QuickInfoController.cs:line 54 at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()

Argument ouf of range in R editor

Create new R script.
Follow these instructions exactly.

Type the following.

print("hello

As you type the above, VS will automatically insert provisional double-quote and closing parenthese, and so you'll see this.

print("hello<cursor is here>")

Now hit delete twice to get rid of the double-quote and closing parenthese.

print("hello

Type a double-quote, note that this insert an additional provisional double-quote.

print("hello"<cursor is here>"

Hit delete to remove the additional double-quote.
Your code should now look like this:

print("hello"

Now hit enter.

Result:

---------------------------
Microsoft Visual Studio
---------------------------
Specified argument was out of the range of valid values.

Parameter name: length
---------------------------
OK   
---------------------------

single-quote and double-quote should not auto-complete inside strings

Auto-completing in this scenario is correct:

print("")
print('')

(typing double-quote automatically gives you a matching ending double-quote, and same for single quote)

But if you insert a single-quote inside a double-quoted string, or a double-quote inside a single-quoted string, then it should NOT auto-complete.

print("let's go to the movies")
print('John said "hello" to Paul')

RStudio and C# editor do this correctly, but right now R editor doesn't.

R editor performance

I am not sure what our performance targets are, but let me give details on how it's performing for me and we can determine if that's acceptable or if we need to make improvements.

I took the following code and copy/pasted it in order to increase the line count.

# R Script
readinteger <- function () {
    n <- readline(prompt = "Enter an integer: ")
    if (!grepl("^[0-9]+$", n)) {
        return (readinteger())
    }
    return (as.integer(n))
}

num <- round(runif(1) * 100, digits = 0)
guess <- -1

cat("Guess a number between 0 and 100.\n")

while (guess != num) {
    guess <- readinteger()
    if (guess == num) {
        cat("Congratulations,", num, "is right.\n")
    }
    else
        if (guess < num) {
            cat("It's bigger!\n")

            cat("It's bigger!\n'")
        }
    else
        if (guess > num) {
            cat("It's smaller!\n")
        }
}

For each of the following, I placed the cursor about in the middle of the sources and manually typed:

guess <- -1
  • At 1000 lines, performance is very good.
  • At 2000 lines, I can perceive a slight delay with each keystroke, but still usable.
  • At 4000 lines, there is a long delay after each keystroke (~1 sec), making it unusable for typing new code.
  • At 8000 lines, delay is about 3-4 secs.

If you type inside a string literal, typing performance is not affected by the line count.

Some R editor default colors too hard to read on dark theme

Colors for braces, brackets and punctuation are dark blue no matter your theme, and on dark theme, dark blue is nearly invisible.

dark-theme

We should optimize the default colors for each theme.

Note: We have the infrastructure for this in PTVS.

ArgumentException when right-clicking on editor

When editing an .R file, right-clicking gives me an activity log error.

System.ArgumentException: Value does not fall within the expected range. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.Shell.OleMenuCommandService.ShowContextMenu(CommandID menuID, Int32 x, Int32 y) at Microsoft.VisualStudio.R.Package.Commands.ShowContextMenuCommand.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg) at Microsoft.Languages.Editor.Controller.Controller.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg) in C:\Projects\GitHub\huguesv\RTVS\src\Languages\Editor\Impl\Controller\Controller.cs:line 51 at Microsoft.Languages.Editor.Controller.ViewController.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg) in C:\Projects\GitHub\huguesv\RTVS\src\Languages\Editor\Impl\Controller\ViewController.cs:line 131 at Microsoft.VisualStudio.R.Package.Interop.CommandTargetToOleShim.Exec(Guid& guidCommandGroup, UInt32 commandID, UInt32 commandExecOpt, IntPtr variantIn, IntPtr variantOut) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.VsMouseProcessor.DisplayContextMenu(Point mousePosition) at Microsoft.VisualStudio.Editor.Implementation.VsMouseProcessor.HandlePreprocessRightButtonUp(InputEventArgs e) at Microsoft.VisualStudio.Editor.Implementation.VsMouseProcessor.PreprocessMouseRightButtonUp(MouseButtonEventArgs e) at Microsoft.VisualStudio.Text.Utilities.WpfMouseProcessor.<>c__DisplayClass41_0.<UIElement_MouseRightButtonUp>b__0(IMouseProcessor p) at Microsoft.VisualStudio.Text.Utilities.WpfMouseProcessor.<>c__DisplayClass56_1.<MouseProcessorHandler>b__0() at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)

Command for R Interactive window is not always present

Start VS
View->Other Windows, "R Interactive Windows" command is missing
Load any .R file or an .R project
Command is now available
Close R files and R projects.
Command still available.

We should make the command always enabled/visible, even if the R package isn't loaded.

Solution Explorer, Add > New Folder creates two folders

  1. Solution Explorer
  2. right click on project
  3. Add > New Folder
  4. type in new folder name 'abc'

Actual: it creates folder 'abc' and 'NewFolder' in Solution Explorer. If the project folder is browsed with file explorer, 'NewFolder' is not created. The 'abc' folder is created correctly.

assertion in editor

Type the following code:

x <- rnorm(10, sd = 5, mean = 20)
y <- 2.5*

When you type the *, you will get this assertion:

---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
Children collection already contains this node



   at Microsoft.R.Core.AST.AstNode.AppendChild(IAstNode child) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\AstNode.cs:line 67

   at Microsoft.R.Core.AST.AstNode.set_Parent(IAstNode value) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\AstNode.cs:line 49

   at Microsoft.R.Core.AST.AstNode.AppendChild(IAstNode child) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\AstNode.cs:line 63

   at Microsoft.R.Core.AST.Expressions.ExpressionParser.MakeNode() in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\ExpressionParser.cs:line 433

   at Microsoft.R.Core.AST.Expressions.ExpressionParser.ProcessHigherPrecendenceOperators(IOperator currentOperator) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\ExpressionParser.cs:line 385

   at Microsoft.R.Core.AST.Expressions.ExpressionParser.Parse(ParseContext context, IAstNode parent) in C:\Projects\GitHub\huguesv\RTVS\src\R\Core\Impl\AST\Expressions\ExpressionPa......

<truncated>
---------------------------
Abort   Retry   Ignore   
---------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.