Omnisharp-vscode: "Add using statement" command missing

Created on 13 Jan 2017  路  17Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-1-003177)

Product Information:
 Version:            1.0.0-preview2-1-003177
 Commit SHA-1 hash:  a2df9c2576

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64

VS Code version: 1.8.1
C# Extension version: 1.6.2

Expected behavior

When typing the name of a class, that isn't currently imported using a using statement, I'd expect to be able to perform the "_add using statement_" command that Visual Studio has offered for a long time.

This command automatically resolves a class name to a .NET namespace inside a .NET assembly that's part of the project, and adds the using statement for that namespace to the current C# code file.

Actual behavior

"Add using statement" command isn't available in Visual Studio Code.

Resolved-Not Reproducible

Most helpful comment

On the Mac it's Command + .

All 17 comments

You should see this. In my experience, I've sometimes had to force it by pressing Ctrl+.

@DustinCampbell I tried using CTRL + ., but it doesn't work. Are you sure it works on Mac OS X?

Yup. The operating system shouldn't impact this feature (assuming you're getting other features like IntelliSense, find all references, go to definition, etc.). I'll play around with this a bit later this week and see if I can find a repro. In the meantime, do you have a small sample project that reproduces the issue?

@DustinCampbell I just reproduced it with a brand new project. I'm testing it out by typing:


... followed by a CTRL + .. It's short for System.Net.Dns, but nothing is coming up.

On the Mac it's Command + .

@pcgeek86 it should work just fine, here is a screenshot from my Mac

screenshot 2017-01-28 15 21 30

Make sure that if you open a folder containing multiple projects, in the bottom right hand corner, where it says Select project, the one that you are currently editing is selected. Also, make sure that the particular assembly is available in your project all (i.e. is NetStandard.Library or the relevant package referenced and restored?)

@pcgeek86: This is working for me too. Do you have a project that consistently reproduces the problem that you could share?

I was able to reproduce this on a fresh project a couple weeks ago, but it looks like some recent updates must have fixed it. Working now, thanks!

Glad to hear it!

I'm having trouble getting this to work on Windows. I'm writing a .net core Functions app. It seemed to work once yesterday, but now there's nothing... is this supported in .net core?

EDIT: after I wrote this it magically started working. If I figure out what's making it so sporadic I'll post back here...

I am having the same issue. Code Completion (add usings) menu does not appear at all in 1.14.
CTRL+ has not effect and on a mac CMD+ is the increase display size screenshot.

Product Information:
Version: 2.1.104
Commit SHA-1 hash: 48ec687460

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.104/

Microsoft .NET Core Shared Framework Host

Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d

@richardmcintyre On the Mac it is CMD and . as in command [dot]

@tverboon ok now I feel like an idiot haha. Working 100% now, Thanks !

@richardmcintyre You're welcome. No need to feel like an idiot, glad I could help 馃槃

This is not working on a fresh install of VSCode (Latest version, 1.30.2) on Windows 10.

@mkyukov Please file a new issue with the relevant information

Yo "using suggestions" don't work for me none either on WSL latest VSCode updated everything, but I get those normal suggestions.

Was this page helpful?
0 / 5 - 0 ratings