In the usual theory of codes, a code $C$ of length $n$ of dimension $d$ over a finite field $F$ is a linear subspace $C$ of $\mathbb{F}^n$ of dimension $d$ normed by the Hamming metric. In this sense, we can view codes as metric linear spaces.
In the usual sense two codes $C_0$ and $C_1$ of the same length over the same field $F$ are said to be equivalent if there is a non-singular diagonal matrix $D$ and permutation matrix $P$ such that $$DP\cdot C_0=C_1$$ One can check that usual properties of linear codes are preserved in this way.
The problem I found is the following, instead of taking the previous approach, I considered a conceptual approach that given two codes $C_0$ and $C_1$ of the same length over the same field $F$ I consider an equivalence of codes the following: a map $$f:C_0\rightarrow C_1$$ such that $f$ is an isometry with respect to the Hamming distance induced in $C_0$ and $C_1$ and $f$ being an $F$-linear isomorphism.
I am aware that these two approaches may not be equivalent since in the second one we are not considering the ambient space. So in some sense a positive answer to the equivalence of both concepts mean that properties of codes are intrinsic not depending on the ambient space.
So my question is if the two previous definition of equivalence are equivalent. Or rephrasing it: Given a Hamming distance preserving $F$ linear mapping
$$f:C\rightarrow F^n$$
of a code $C$ of length $n$ into its ambient space, can be always be extended to a Hamming distance preserving $F$-linear isomorphism $\hat{f}:F^n\rightarrow F^n$?
Yes. This is exactly the MacWilliams equivalence theorem (sometimes also called extension theorem).