Suppose the code contains an identifier abc that could be resolved by importing it from either module a or module b. Presently, getCodeFixes-full returns two code fixes - one each for a and b - with the same fixId. This causes two problems:
- VS de-dupes fixes with the same fixId so only the fix for
a is shown.
- If fix-all is applied with the given fixId, the first fix with that fixId at each diagnostic span is used, which is somewhat arbitrary.
We can resolve both problems by including the module name in the fixId:
- The fixIds will differ and neither fix will be dropped by VS.
- fix-all will add an import to a single module and update all the diagnostic spans that can be resolved with an import from that module.
Suppose the code contains an identifier
abcthat could be resolved by importing it from either moduleaor moduleb. Presently,getCodeFixes-fullreturns two code fixes - one each foraandb- with the same fixId. This causes two problems:ais shown.We can resolve both problems by including the module name in the fixId: