Code Monkey home page Code Monkey logo

visualrust's Introduction

Visual Studio extension for Rust

Build status

Screenshot

Currently in development, and not feature complete. Stable versions are available on the Visual Studio extension gallery.

Unstable, but more recent builds are downloadable from AppVeyor (choose "Configuration: Release" and "Artifacts").

Features

  • Project support based on Cargo
  • Syntax highlighting
  • Autocomplete
  • Go to definition
  • Debugging for both MSVC and GNU toolchains
    • Conditional breakpoints
    • Watch window (with the ability to change the runtime state)
    • Immediate window (with the ability to change the runtime state)
    • Set next statement
    • Call stack view and navigation

Contributing

How to contribute?

Issues

Feel free to open issues, post comments about progress, questions, new ideas, brain storming etc. You can remove and edit comments as a way of refining ideas in the issue tracker. This is very helpful because many concerns in this project are very complex. Many issues needs to be broken down into new issues before they can be implemented.

Issues marked Ready represent tasks that have a clear design and deliverables. They are recommended starting points if you don't want to spend time discussing and evaluating implementation.

Issues marked Information require some wider perspective and discussion. They are perfect if you want to have an impact on the project but don't have the time to spend coding.

Code

  1. Fork the main repository
  2. Work on a feature in your own private branch
  3. Once you are finished with you work or want someone to you, open a pull request
  4. Someone will review your code and merge it. Some fixes might be required on your side.

Prerequisites

To build this, you'll need Visual Studio 2015 and matching Visual Studio SDK for the VS plugin, WiX Toolset 3.10 or higher for the setup project and Java RE. NuGet will take care of the rest.

Build configuration

If you plan to hack on Visual Rust you should understand difference between our two build configurations.

  • For the Release configuration the main project is VisualRust.Setup, its output is a .msi file that consists of two parts:

    • MSBuild integration: this lets you build Rust projects (.rsproj) from the command line and Visual Studio.
    • Visual Studio plugin(s): this adds support for Rust projects (.rsproj) inside Visual Studio. Syntax highlighting, project system, item templates. Everything except building.
  • For the Debug build main project is called simply VisualRust and it builds VisualRust.vsix which is a VS plugin in a format that is suitable for local installation and debugging. It doesn't contain MSBuild integration

Consequently, for the debug build you'll want to either install just MSBuild integration from the .msi file or build it yourself (VisualRust.Build) and copy to %ProgramFiles(x86)%\MSBuild\VisualRust.

Also you'll want to modify VisualRust project with location of your Visual Studio installation to launch it automatically when debugging.

Contact

This project is currently maintained by vosen.

Feel free to mail him or ask around in #rust-gamedev on irc.mozilla.org.

License

Same as Rust, dual MIT/ASL2. Any contributions made are under this license.

visualrust's People

Contributors

andersforsgren avatar boddlnagg avatar bvssvni avatar emberian avatar ioncodes avatar jonyee avatar leonkunert avatar murphm8 avatar vadimcn avatar vbif avatar vosen avatar waffle-iron avatar xilec avatar yacoder 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

visualrust's Issues

Autocompletion icons

Autocompletion icons we currently use are kinda shabby. It would be nice to have something nicer.

Add screenshot

On the VS Gallery page as well as the GitHub Readme, please include screenshots so people can see what it looks like. I've found that people don't download extensions when they don't at least have a visual indication of what to expect.

Improve setup

We moved from .vsix to .msi (#24). This is an improvement, but the current solution installer script is not the greatest. When running .msi installer, as one of the actions, we find VsixInstaller.exe (part of VS) and run it on unpacked VisualRust.vsix. There are few bugs and deficiencies related to this:

  • VisualRust.vsix is left lying in Program Files/VisualRust
  • User can uninstall extension from "Extensions and Updates" window without going through installer
    The above can be solved by going though immense fun of "manually" (using normal WIX means) installing and uninstalling vs packages and templates and marking vsix with InstalledByMsi="true".

Also, two small problems:

  • Wrong License is being displayed
  • No version choice in the installer (though that touches #21)

Build bundled racer

Currently, we are shipping racer binaries. Better solution would be to add racer submodule and .rsproj project that builds it.
I'm not sure how possible it's at the moment but with project pages not being yet implemented that will require manual work with .rsproj.
Also, this will probably require adding support for loading project from nested path (currently we only allow crate root module to be <location of project.rsproj>\src\main.rs or <location of project.rsproj>\src\lib.rs, but if we are to use submodules we will want support for <location of project.rsproj>\arbitrary\nested\path\to\src\main.rs)

Show docs on F1

To my mind, We need add VisualRust where we already can add some simple but useful commands. For instance:

  • open official Rust docs site with search by word on cursor position
  • add/remove selected lines comments
    and so on

VS Express support

Is it even possible? if so it'd be really great.

iirc iron python seems to work on express editions if that's any indication of likelyhood to work

Figure out how to dedent when } is pressed

There is IVsTextViewCreationListener, which seems to be able to tie into the ContentType quite nicely, but in order to perform editor operations, an ITextView is needed. Figure out:

  1. Why the event listener is never getting called
  2. Whether this is the right thing to do at all

Update lexer grammar

The lexer grammar we are currently using is few months old. Get updated version from Rust and check it for missing rules (mainly keywords).

Run without debugger support

Running a project with Control+F5 usually allows the program to run without a debugger and keeps the command window open until the user closes it. Currently, the program just runs as usual when using the Control modifier.

Add cargo integration

  • Adding dependencies
  • Updating the lockfile
  • Build the project
  • Run tests
  • Run benchmarks

Figure out if we should provide a language service

See http://msdn.microsoft.com/en-us/library/bb165662.aspx. It seems to do a lot for you? But looking at the Python Tools for Visual Studio extension, it seems they don't really use it, and just stub stuff out.

However, this seems to be the only way to get Rust into the "Text Editor" part of the options dialog? It also seems to provide things like brace matching, which is what I would expect. It's possible that providing a LanguageService is the right thing to do, and that the "walkthroughs" on how to implement brace matching etc are just examples of using the APIs and aren't really for production use.

Missing VisualRustPackage.cs

I'm trying to get this to build (I have never tinkered with extensions before) and I'm getting an error saying it's missing VisualRustPackage.cs in the VisualRust project.

Any chance of getting a quick setup guide in the README? I had to download the Visual Studio SDK to open the project, which might be worth mentioning.

Stop lexing everything on demand when calculating smart indention

As it is now, when Visual Studio asks out implementation of smart indentation we can end up lexing whole document.
This is not very good. Mostly because we are lexing whole document already. It happens inside RustClassifier.cs.
proper implementation of our smart indention should connect to the output of RustClassifier, cache information about lexed braces and parens, and finally use that cached information inside VisualRustSmartIndent. This might require some thinking of how exactly share that information between indenter and classifier and when to flush the cache, but should be fairly straightforward.

VisualRust.Shared is missing from installation package

The generated installation package VisualRust.msi is missing VisualRust.Shared.dll that is required for VisualRust.Build.dll to run. This results in this exception during build:

------ Build started: Project: RustApplication2, Configuration: Debug AnyCPU ------
C:\Program Files (x86)\MSBuild\VisualRust\VisualRust.Rust.targets(19,5): error : Could not load file or assembly 'VisualRust.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=401f5d177ee7d4a2' or one of its dependencies. The system cannot find the file specified.
   at VisualRust.Build.Rustc.ExecuteInner()
   at VisualRust.Build.Rustc.Execute()
Done building project "RustApplication2.rsproj" -- FAILED.

VIsualRust build used:
https://ci.appveyor.com/project/vosen/visualrust/build/job/ubhcib4nvxt95i72/artifacts

Building VisualRust.Shared manually and additing to C:\Program Files (x86)\MSBuild\VisualRust\ helps.

Move project system away from MSBuild

Currently we use MPF to manage project files (.rsproj). It saves us writing a lot of boilerplate and figuring all the minute details of VS COM interfaces. It would be much nicer to base everything off Cargo.toml but that would take considerable effort (we'd lose most of the MPF niceties). In case if someone is interested in this, any work on this from my side will happen in "no-msbuild" branch in my fork (if I ever actually get around to start implementing this).

Target Visual Studio 2012

We are currently building only for VS2013, it should be a matter of changing definitions in .vsixmanifest and actually testing generated .vsix. Since both 2012 and 2013 version targets .Net 4.5 it won't affect the code.

Create Visual Studio Shell version

We currently target commercial versions of VS, but some language plugins (PyTools, F# Tools) can run under Isolated Shell and Express edition. It'd be really nice to achieve the same compatibility in VisualRust.

Add debugging support

This is of course predicated on rustc emitting debuginfo (pdb?) that Visual Studio can understand, but there's nothing nicer than Visual Studio's debugger.

Multiline comments are not parsed correctly

Multiline comments are not parsed/highlighted correctly when they actually span multiple lines. Probably an ANTLR grammar problem.

Edit (clarification): I'm talking about block comments /* ... */

Sanity check our enviroment

This is something that came up during racer PR (#66).
In a nutshell: we rely on rustc.exe, racer.exe and %RUST_SRC_PATH% being set up correctly and being compatible with each other. This is very rarely going to happen.
This is why we need to double check our environment and tell the user how can he fix that.

Copy-pasting from #66, this is how I see it being done:

  • Check if rustc is in %PATH% (or in our settings). If it is not present, offer to download and run nightly installer.
  • Check if racer.exe is in %PATH% (or in our settings). If it is present, sanity check it by starting racer.exe. If it's not present fall back to racer we ship ourselves (with libgcc_s_dw2-1.dll and rust libraries). If our racer crashes suggest that it might be incompatible with rustc and tell user to compile it himself.
    AFAIK linking to rust libraries is ABI compatible. So if you link to syntax-4e7c5e5c.dll, next time binary incompatible libsyntax is compiled it'll be named syntax-<some_other_hash>.dll. If we want to make sure, we can always check with dumpbin.
  • Check if there's env var (or in our settings) pointing to something that looks like rust source. If we have nothing like that, offer to the user to git clone rust sources (we can get commit hash from rustc --version verbose).

As for the UI we should do it the same way Git Extensions (https://code.google.com/p/gitextensions/) does it. First time .rs or .rsproj file is opened run above checks and if something is wrong present an UI that shows what's wrong at the first glance and suggests fixes. Screen of window that shows broken settings with Git Extensions.

Handle commenting/uncommenting

As mentioned in #95, handle commenting/uncommenting from Edit/Advanced/Comment Selection (Uncomment too).
Consider handling other editor commands that require language support too.

Add a project system

  • Recognize rust projects
  • Add project template for application (equivalent to cargo new)
  • Add project template for binary (equivalent to cargo new --bin)
  • Add project template for creating projects from existing codebase
  • Add support for adding .rs items to projects
  • Support build/rebuild/clean
  • Get rid of "Add references"
  • Add property pages
  • Force proper project structure

Add profiling support

This is perhaps only in Ultimate, but add support for profiling Rust programs. Probably blocked on #13.

Move to a full installer

Currently we ship extension using .vsix packages. Unfortunately .vsix packages doesn't support adding custom system-wide msbuild .targets. We need this to properly support building rust code (there are alternatives, but they are all horrible).
We are using WiX Toolset (version 3.9), since it has some support for vsix.
This blocks #4.

Automatically dedent right paren/right bracket

We now have a simple smart indent implementation in VisualSRustSmartIndent.cs.
This is good, but slightly annoying when it comes to right paren/right bracket insertions
For example, without auto dedention:

fn foo() {
····bar();
····baz();

now inserting } at the end of the file leads to

fn foo() {
····bar();
····baz();
····}

Auto dedention should correct it to

fn foo() {
····bar();
····baz();
}

Note, that autodedention should know know the difference between } and ) and auto-dedent to the "level" of the right token.

Improve smart indenting

  • Make it token based, not textual (may require some infrastructure work to expose lexing of lines)
  • Don't look as far back for opening { (only keep looking if prevLines are only whitespace)
  • Handle things like breaking function calls on multiple lines (should align with first argument)
  • Dedent on }

Add a squiggle tagger

Compilation errors/warnings/etc should put squiggles in the buffer and perhaps a glyph in the margin.

Make rustc output parsing more robust

While testing #112 I found at least one case, where the current RegEx for error messages does not work correctly. Given this rustc output

main.rs:118:22: 118:26 error: mismatched types:
 expected `&mut [u8]`,
    found `&[u8; 2]`
(values differ in mutability) [E0308]
main.rs:118     match stdin.read(&buf) {
                                 ^~~~

the RegEx will only extract the first line and discard the additional information, resulting in the error message mismatched types:

I'm not sure how this should be fixed.

Find a way to link errors to page with explanations

It would be nice if we could overwrite the behavior of the "Show Error Help" command in the context menu of the error pane (see this example image) to open the page http://doc.rust-lang.org/error-index.html with the appropriate anchor (e.g. this for E0297). We already forward the error codes, but probably something needs to be done within the actual VS extension (as opposed to the MSBuild module, which only outputs text that is then automatically parsed by VS).

Error when erasing two consecutive 'fn' tokens.

Take the following code:

fn main() {
    println!("Hello world!");
}

fn fn 

Now erase the last line and an error should pop up in VS asking to check [MyVSPath]/ActivityLog.xml, which contains the following entry occurring last:

  <entry>
    <record>840</record>
    <time>2014/09/12 21:28:51.934</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.&#x000D;&#x000A;Parameter name: index&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Implementation.SimpleStringRebuilder.get_Item(Int32 index)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Implementation.TextSnapshot.get_Item(Int32 position)&#x000D;&#x000A;   at ArkeIndustries.VisualRust.RustBraceMatcher.&lt;GetTags&gt;d__6.MoveNext()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.&lt;GetTagsForBuffer&gt;d__5.MoveNext()</description>
  </entry>

Improve auto-completion performance

Currently, auto-completion is slow. There might be several reasons for that: text manipulation costs, racer.exe launch time, something else?
We should also try running stuff asynchronously.

Fix lexer grammar for float suffix

The current lexer creates separate tokens for float suffixes (like f32). This breaks the mapping from ANTLR tokens to VS tags (try a file with Vec<f32> for example). I submitted a pull request to Rust (rust-lang/rust#17625), we should just sync the file when that is accepted.

Force proper project structure

Most commonly, for languages like C#, F# or C++ you pass the list of files to compile and leave it to the compiler to sort everything out. Rust is different in that it compiles from a single entry point file (main.rs or lib.rs most commonly) and follows modules from source code. So the default mode of operation of MSBuild doesn't quite fit here. The solution will be to not so subtly force user to follow proper layout.

  • Load module-referenced files after project files are loaded (roots are .rs files and the entry point).
  • Track module additions/removals to file (might create new subtrees or roots).
  • Visually mark roots that are not the entry point.

This is part of #4, but it's quite complicated so I split it to a different issue.

Add an options menu

For example, Tools > Options > Text Editor > C# has a bunch of knobs to tweak. Figure out how to get in that list.

New installer can't uninstall old version from the VS Gallery

I tried version from Visual Studio extension gallery but it is very incomplete, it has only syntax highlightning, there is even no compilation (or I wasn't able to figure out how to make it work). Therefore I downloaded and compiled latest master but installer fails with this error:
"There is a problem with Windows package. A program run as part of the setup did not finish as expected."
It doesn't provide more details.

Add navigation from an error list entry to a document

Currently, when building rust project build errors appear in error list. Double clicking on them should bring up the document that contains the error

This behaviour can be fixed by passing and instance of DocumentTask instead of ErrorTask in IDEBuildLogger. This shouldn't be too complicated, but in case something is unclear you can check Visual F# to see how they are doing it.

I think it also provides squiggles.

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.