10000 fix: use .ts/.tsx extension for internal virtual .js/.jsx codegen files by rchl · Pull Request #3353 · vuejs/language-tools · GitHub
[go: up one dir, main page]

Skip to content

fix: use .ts/.tsx extension for internal virtual .js/.jsx codegen files #3353

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: use TS extension for internal, generated codegen files
  • Loading branch information
rchl committed Jul 2, 2023
commit 7702515f2d716cfaa7aa8d2f1d3352428a20682d
6 changes: 4 additions & 2 deletions packages/vue-language-core/src/plugins/vue-tsx.ts
D407
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const plugin: VueLanguagePlugin = ({ modules, vueCompilerOptions, compilerOption
const tsx = useTsx(fileName, sfc);
const fileNames: string[] = [];

if (['js', 'ts', 'jsx', 'tsx'].includes(tsx.lang.value)) {
if (['ts', 'tsx'].includes(tsx.lang.value)) {
fileNames.push(fileName + '.' + tsx.lang.value);
}

Expand Down Expand Up @@ -112,10 +112,12 @@ const plugin: VueLanguagePlugin = ({ modules, vueCompilerOptions, compilerOption
function createTsx(fileName: string, _sfc: Sfc) {

const lang = computed(() => {
return !_sfc.script && !_sfc.scriptSetup ? 'ts'
const lang = !_sfc.script && !_sfc.scriptSetup ? 'ts'
: _sfc.scriptSetup && _sfc.scriptSetup.lang !== 'js' ? _sfc.scriptSetup.lang
: _sfc.script && _sfc.script.lang !== 'js' ? _sfc.script.lang
: 'js';
// Normalize 'js*' to 'ts*' as generated files are technically written in TypeScript.
return lang.replace(/^js/, 'ts');
});
const scriptRanges = computed(() =>
_sfc.scriptAst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
v-for="col in slotFilters"
:key="col"
#[`filter-cell-${col}`]="{ column }"
></template>
>{{ column }}</template>
</Foo>
</template>

<script setup></script>
<script setup>
const slotFilters = [1, 2]
</script>
0