Comments (2)
I did not consider the possibility for nested namespaces or nested using statements, thank you for pointing this out. I fixed it in the newest version.
But be aware that only fully-qualified using statements will work. In your case you could also write your using statement with just "Models":
namespace Thaum.Gw2Api.Clients
{
using System.Threading;
using System.Threading.Tasks;
using AutoInterfaceAttributes;
using Models; // refers to "Thaum.Gw2Api.Models", but generated code will refer to just "Models"
[AutoInterface]
public sealed class Gw2AccountApi : IGw2AccountApi
{
But not fully-qualified using statements are dangerous, because they can be ambiguous. For example if you create somewhere in your project the namespace “Thaum.Gw2Api.Clients.Models”, all your nested “Models” usings inside the “Thaum.Gw2Api.Clients” namespace will suddenly refer to “Thaum.Gw2Api.Clients.Models” and you get compile errors all over the place. That’s why usually using statements are always full qualified and put at the top of a file.
I also left a note in README.md: #remark
from autointerface.
Thanks for the quick fix!
I'm aware of the caveats with using using declarations within a namespace, it's bitten me before - so I do keep them fully-qualified, I just prefer the structure of having them within the namespace because of other languages I've worked with, so I don't foresee any issues for me.
I do need more source-generator experience, so I may in the near future submit a PR to handle both cases (i.e. generate output to match the structure of inputs), if you'd accept one?
Thanks again!
from autointerface.
Related Issues (12)
- Support for Records HOT 1
- Support for attributes HOT 1
- Support Nested Interfaces HOT 2
- Interfaces from Records don't generate Deconstruct method HOT 1
- Nested Classes can't produce top-level interfaces HOT 2
- Methods with Generics not generating into interface HOT 1
- Declared elements from existing interfaces being duplicated in generated interface HOT 1
- Feature Request: Attribute Filtering HOT 2
- Feature 'file-scoped namespaces' is not available. Please use language version 10.0 or greater. HOT 4
- Overwriting Generated Files with Same Name HOT 2
- Inherited class members are not included in generated interface HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autointerface.