Skip to content

Commit

Permalink
[cascading] from release/11.6.0-rc to main (#2676)
Browse files Browse the repository at this point in the history
<!--
{"currentBranch":"release/11.6.0-rc","targetBranch":"main","bypassReviewers":false,"isConflicting":false}
-->

## Cascading from release/11.6.0-rc to main

---

<small>This Pull Request has been generated with ❤️ by the
[Otter](https://github.com/AmadeusITGroup/otter) cascading tool.</small>
  • Loading branch information
matthieu-crouzet authored Jan 8, 2025
2 parents 78cfcbb + 59b5ec4 commit 4fee47d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
"org.openapitools:openapi-generator"
],
"groupName": "Open API updates",
"groupSlug": "openapi"
"groupSlug": "openapi",
// TODO wait for https://github.com/OpenAPITools/openapi-generator/issues/20135 to be fixed before upgrading to 7.10.0
"enabled": false
},
{
// We don't want to update this dep as we are still targeting a fork
Expand Down
1 change: 1 addition & 0 deletions apps/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
"@types/node": "^20.0.0",
"@types/vscode": "^1.67.0",
"@typescript-eslint/parser": "~8.19.0",
"@typescript-eslint/utils": "~8.19.0",
"@vscode/vsce": "^2.16.0",
"angular-eslint": "~18.4.0",
"cpy-cli": "^5.0.0",
Expand Down
4 changes: 3 additions & 1 deletion apps/vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
commands,
ExtensionContext,
languages,
window,
} from 'vscode';
import {
extractAllToVariable,
Expand Down Expand Up @@ -60,10 +61,11 @@ import {
* @param context
*/
export function activate(context: ExtensionContext) {
const channel = window.createOutputChannel('Otter');
const designTokenProviders = designTokenCompletionItemAndHoverProviders();

context.subscriptions.push(
languages.registerCompletionItemProvider(['javascript', 'typescript'], configurationCompletionItemProvider(), configurationCompletionTriggerChar),
languages.registerCompletionItemProvider(['javascript', 'typescript'], configurationCompletionItemProvider({ channel }), configurationCompletionTriggerChar),
languages.registerCompletionItemProvider(['scss'], stylingCompletionItemProvider(), stylingCompletionTriggerChar),
languages.registerCompletionItemProvider(['scss', 'css'], designTokenProviders),
languages.registerHoverProvider(['scss', 'css'], designTokenProviders),
Expand Down
17 changes: 11 additions & 6 deletions apps/vscode-extension/src/intellisense/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
CompletionItem,
CompletionItemKind,
CompletionItemProvider,
type OutputChannel,
SnippetString,
} from 'vscode';
import type {
Expand All @@ -11,9 +12,6 @@ import type {
import type {
TSESLint,
} from '@typescript-eslint/utils';
import {
ESLint,
} from 'eslint';

interface ConfigurationTags {
/** @see CompletionItem.documentation */
Expand Down Expand Up @@ -115,8 +113,15 @@ const getConfigurationTagsFromEslintConfig = (eslintConfig: TSESLint.FlatConfig.
};
};

export const configurationCompletionItemProvider = (): CompletionItemProvider<CompletionItem> => {
const eslint = new ESLint();
export const configurationCompletionItemProvider = (options: { channel: OutputChannel }): CompletionItemProvider<CompletionItem> => {
const eslint = import('eslint')
// eslint-disable-next-line @typescript-eslint/naming-convention -- External package defined name
.then(({ ESLint }) => new ESLint())
.catch((err) => {
options.channel.appendLine('Error during ESLint loading:');
options.channel.appendLine(JSON.stringify(err));
return undefined;
});

return {
provideCompletionItems: async (doc, pos) => {
Expand Down Expand Up @@ -150,7 +155,7 @@ export const configurationCompletionItemProvider = (): CompletionItemProvider<Co
return [];
}

const config = (await eslint.calculateConfigForFile(doc.fileName)) as TSESLint.FlatConfig.Config;
const config = await (await eslint)?.calculateConfigForFile(doc.fileName) || {};
const configurationTags = getConfigurationTagsFromEslintConfig(config, match[0], fileText);

return getCompletionsItemsFromConfigurationTags(configurationTags);
Expand Down
2 changes: 1 addition & 1 deletion packages/@ama-sdk/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"tsc-watch": "^6.0.4",
"yaml-eslint-parser": "^1.2.2"
},
"openApiSupportedVersion": "~7.10.0",
"openApiSupportedVersion": "~7.9.0",
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>7.10.0</version>
<!-- TODO wait for https://github.com/OpenAPITools/openapi-generator/issues/20135 to be fixed before upgrading to 7.10.0 -->
<!-- Don't forget to enable the custom manager in .renovaterc.json5 -->
<version>7.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30019,6 +30019,7 @@ __metadata:
"@types/node": "npm:^20.0.0"
"@types/vscode": "npm:^1.67.0"
"@typescript-eslint/parser": "npm:~8.19.0"
"@typescript-eslint/utils": "npm:~8.19.0"
"@vscode/vsce": "npm:^2.16.0"
angular-eslint: "npm:~18.4.0"
cpy-cli: "npm:^5.0.0"
Expand Down

0 comments on commit 4fee47d

Please sign in to comment.