@lvce-editor/extension-host-worker 8.46.0 → 8.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1957,10 +1957,9 @@ const executeClosingTagProvider = async (textDocumentId, ...args) => {
|
|
|
1957
1957
|
};
|
|
1958
1958
|
|
|
1959
1959
|
const {
|
|
1960
|
-
executeCodeActionProvider,
|
|
1960
|
+
executeCodeActionProvider: executeRegisteredCodeActionProvider,
|
|
1961
1961
|
getProvider: getProvider$b,
|
|
1962
|
-
registerCodeActionProvider
|
|
1963
|
-
} = create$6({
|
|
1962
|
+
registerCodeActionProvider} = create$6({
|
|
1964
1963
|
name: 'CodeAction',
|
|
1965
1964
|
resultShape: {
|
|
1966
1965
|
items: {
|
|
@@ -1969,6 +1968,30 @@ const {
|
|
|
1969
1968
|
type: Array$1
|
|
1970
1969
|
}
|
|
1971
1970
|
});
|
|
1971
|
+
const executeCodeActionProvider = async uid => {
|
|
1972
|
+
if (!hasLegacyProvider(getProvider$b, uid)) {
|
|
1973
|
+
const isolated = await execute('code action', 'provideCodeActions', uid);
|
|
1974
|
+
if (isolated.found) {
|
|
1975
|
+
return isolated.result;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
return await executeRegisteredCodeActionProvider(uid);
|
|
1979
|
+
};
|
|
1980
|
+
const toSourceAction = (languageId, action) => {
|
|
1981
|
+
return {
|
|
1982
|
+
kind: action.kind,
|
|
1983
|
+
languageId,
|
|
1984
|
+
name: action.name
|
|
1985
|
+
};
|
|
1986
|
+
};
|
|
1987
|
+
const getSourceActions = async uid => {
|
|
1988
|
+
const textDocument = get$a(uid);
|
|
1989
|
+
if (!textDocument) {
|
|
1990
|
+
return [];
|
|
1991
|
+
}
|
|
1992
|
+
const actions = await executeCodeActionProvider(uid);
|
|
1993
|
+
return actions.map(action => toSourceAction(textDocument.languageId, action));
|
|
1994
|
+
};
|
|
1972
1995
|
const isOrganizeImports = action => {
|
|
1973
1996
|
return action.kind === 'source.organizeImports';
|
|
1974
1997
|
};
|
|
@@ -1981,7 +2004,7 @@ const executeOrganizeImports = async uid => {
|
|
|
1981
2004
|
return isolated.result;
|
|
1982
2005
|
}
|
|
1983
2006
|
}
|
|
1984
|
-
const actions = await
|
|
2007
|
+
const actions = await executeRegisteredCodeActionProvider(uid);
|
|
1985
2008
|
// @ts-ignore
|
|
1986
2009
|
if (!actions || actions.length === 0) {
|
|
1987
2010
|
return [];
|
|
@@ -7125,6 +7148,7 @@ const commandMap = {
|
|
|
7125
7148
|
'ExtensionHost.importExtension': importExtension,
|
|
7126
7149
|
'ExtensionHost.importExtension2': importExtension2,
|
|
7127
7150
|
'ExtensionHost.launchIframeWorker': launchIframeWorker,
|
|
7151
|
+
'ExtensionHostCodeActions.getSourceActions': getSourceActions,
|
|
7128
7152
|
[BraceCompletionExecuteBraceCompletionProvider]: executeBraceCompletionProvider,
|
|
7129
7153
|
[ClosingTagExecuteClosingTagProvider]: executeClosingTagProvider,
|
|
7130
7154
|
[CommandExecute]: executeCommand$1,
|