Skip to content
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

Support default.setting completion + hover #717

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 19 additions & 11 deletions packages/theme-language-server-node/src/metafieldDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,25 @@ export async function fetchMetafieldDefinitionsForURI(uri: string) {
}
}

// eslint-disable-next-line no-unused-vars
async function getShopifyCliPath() {
if (isWin) {
const { stdout } = await exec(`where.exe shopify`);
const executables = stdout
.replace(/\r/g, '')
.split('\n')
.filter((exe) => exe.endsWith('bat'));
return executables.length > 0 ? executables[0] : '';
} else {
const { stdout } = await exec(`which shopify`);
return stdout.split('\n')[0].replace('\r', '');
if (process.env.NODE_ENV === 'test') {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooo nice catch

}

try {
if (isWin) {
const { stdout } = await exec(`where.exe shopify`);
const executables = stdout
.replace(/\r/g, '')
.split('\n')
.filter((exe) => exe.endsWith('bat'));
return executables.length > 0 ? executables[0] : '';
} else {
const { stdout } = await exec(`which shopify`);
return stdout.split('\n')[0].replace('\r', '');
}
} catch (_) {
// If any errors occur while trying to find the CLI, we will silently return
return;
}
}
Loading