dotnet / dotnet/vscode-csharp

Change namespace refactoring includes Assets.Scripts for Unity

Open
#3,670 3 comments 1 reaction 0 assignees View on GitHub
Feature Request Triaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##
When I try to use refactoring which adjusts namespace with folder hierarchy it wants to use {RootNamespace}.Assets.Scripts.{Folders}. For Unity projects I want to skip this prefix and use only {RootNamespace}.{Folders} as namespace. I tried to set RootNamespace to {BrandName.Product} and BaseDirectory to Assets/Scripts, but no changes.

JFYI: I've found similar resharper issue. Seems that it was solved: https://github.com/JetBrains/resharper-unity/issues/6

## Steps to Reproduce ##
Create Unity project, open any script with vscode,
Try to use namespace refactoring.

## Expected Behavior ##
It suggests {RootNamespace}.{Folders} (skip Assets/Scripts from namespace providing)

## Actual Behavior ##
It suggests {RootNamespace}.Assets.Scripts.{Folders}

## Logs ##

### OmniSharp log ###
Post the output from Output-->OmniSharp log here

### C# log ###
Post the output from Output-->C# here

## Environment information ##

**VSCode version**: 1.42.1
**C# Extension**: 1.21.14

Mono Information
OmniSharp using global mono :6.8.0
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.102
Commit: 573d158fea

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

Host (useful for support):
Version: 3.1.2
Commit: 916b5cba26

.NET Core SDKs installed:
3.1.102 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|csharp|ms-dotnettools|1.21.14|
|intellij-idea-keybindings|k--kato|0.2.37|
|pgformatter|bradymholt|1.12.0|
|unity-debug|Unity|2.7.3|
|vscode-edit-csv|janisdd|0.2.6|
|vscode-scss|mrmlnc|0.9.0|
|vscode-scss-formatter|sibiraj-s|1.4.3|
|vscode-typescript-tslint-plugin|ms-vscode|1.2.3|
|vscode-unitymeta|PTD|0.0.7|
|vscode-versionlens|pflannery|0.25.0|
|xml|DotJoshJohnson|2.5.0|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.