1- import { workspace , ExtensionContext , commands , window } from 'vscode'
2- import { existsSync , promises as fs } from 'fs'
3- import { join } from 'pathe'
4- import { isNuxtProject , getConfiguration } from './utils'
1+ import { ExtensionContext , commands } from 'vscode' ;
52import { activateExtension } from './extension'
63
74export async function activate ( context : ExtensionContext ) {
5+ const nuxtProject = true
86
9- let userRoot : string | undefined
10-
11- const configuration = getConfiguration ( ) . monorepoMode . DirectoryName
12-
13- if ( ! configuration ) {
14- userRoot = workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath
15- } else {
16- userRoot = workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath + `/` + configuration
17- }
18-
19- if ( ! userRoot && ! existsSync ( `${ userRoot } /package.json` ) ) { return }
20-
21- const nuxtConfigPathTS = join ( `${ userRoot } /` , 'nuxt.config.ts' )
22- const nuxtConfigPathJS = join ( `${ userRoot } /` , 'nuxt.config.js' )
23-
24- const nuxtConfigExistsTS = await fs . access ( nuxtConfigPathTS ) . then ( ( ) => true ) . catch ( ( ) => false )
25- const nuxtConfigExistsJS = await fs . access ( nuxtConfigPathJS ) . then ( ( ) => true ) . catch ( ( ) => false )
26-
27- if ( ! nuxtConfigExistsTS && ! nuxtConfigExistsJS ) { return }
28-
29-
30- const nuxtProject = await isNuxtProject ( )
31-
32- if ( nuxtProject ) {
33- commands . executeCommand ( 'setContext' , 'nuxtr.isNuxtProject' , nuxtProject )
34- activateExtension ( context )
35-
36- } else {
37- commands . executeCommand ( 'setContext' , 'nuxtr.isNuxtProject' , nuxtProject )
38- window . showInformationMessage ( 'Nuxtr: Not a Nuxt project' )
39- }
7+ commands . executeCommand ( 'setContext' , 'nuxtr.isNuxtProject' , nuxtProject )
8+ activateExtension ( context )
409}
0 commit comments