Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Add using statement" command missing #1117

Closed
pcgeek86 opened this issue Jan 13, 2017 · 17 comments
Closed

"Add using statement" command missing #1117

pcgeek86 opened this issue Jan 13, 2017 · 17 comments

Comments

@pcgeek86
Copy link

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.

@DustinCampbell
Copy link
Member

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

@pcgeek86
Copy link
Author

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

@DustinCampbell
Copy link
Member

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?

@pcgeek86
Copy link
Author

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

Dns

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

@tverboon
Copy link

On the Mac it's Command + .

@filipw
Copy link
Contributor

filipw commented Jan 28, 2017

@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?)

@DustinCampbell
Copy link
Member

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

@pcgeek86
Copy link
Author

pcgeek86 commented Feb 6, 2017

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!

@pcgeek86 pcgeek86 closed this as completed Feb 6, 2017
@DustinCampbell
Copy link
Member

Glad to hear it!

@jmotes
Copy link

jmotes commented Dec 1, 2017

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...

@richardmcintyre
Copy link

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

@tverboon
Copy link

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

@richardmcintyre
Copy link

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

@tverboon
Copy link

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

@mkyukov
Copy link

mkyukov commented Jan 15, 2019

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

@akshita31
Copy link
Contributor

@mkyukov Please file a new issue with the relevant information

@johnarleyburns
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants