From 0d635626aa687ab7fc83da010ef90fb3f0feba0d Mon Sep 17 00:00:00 2001 From: AdRiley Date: Fri, 23 Feb 2024 11:12:21 +0000 Subject: [PATCH 01/26] Added unique, deduplicate aliases for distinct (#9152) Added unique, deduplicate aliases for distinct --- distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso | 3 ++- distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso | 3 ++- .../lib/Standard/Database/0.0.0-dev/src/Data/DB_Table.enso | 3 ++- distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso index dd3f64bacecc..aec254bbf014 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso @@ -306,7 +306,8 @@ type Array to_list : List to_list self = Array_Like_Helpers.to_list self - ## GROUP Selections + ## ALIAS unique, deduplicate + GROUP Selections ICON preparation Keeps only unique elements within the array, removing any duplicates. diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso index 24f7c648671a..2b1a67fb0e24 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso @@ -1047,7 +1047,8 @@ type Vector a sort self (order = Sort_Direction.Ascending) on=Nothing by=Nothing on_incomparable=Problem_Behavior.Ignore = Array_Like_Helpers.sort self order on by on_incomparable - ## GROUP Selections + ## ALIAS unique, deduplicate + GROUP Selections ICON preparation Keeps only unique elements within the vector, removing any duplicates. diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/DB_Table.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/DB_Table.enso index d84b4fe709de..223247fc3026 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/DB_Table.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/DB_Table.enso @@ -1138,7 +1138,8 @@ type DB_Table # If the key is a result of a join, union or a subquery then it has no notion of primary key. _ -> Nothing - ## GROUP Standard.Base.Selections + ## ALIAS unique, deduplicate + GROUP Standard.Base.Selections ICON preparation Returns the distinct set of rows within the specified columns from the input table. diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso index 49b45e491949..fa0b101094ea 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso @@ -823,7 +823,8 @@ type Table self.java_table.orderBy java_columns directions comparator Table.Value java_table - ## GROUP Standard.Base.Selections + ## ALIAS unique, deduplicate + GROUP Standard.Base.Selections ICON preparation Returns the distinct set of rows within the specified columns from the input table. From 7ff90aa3f7c63c9809101d05ec3595a3970f0063 Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Fri, 23 Feb 2024 11:18:01 +0000 Subject: [PATCH 02/26] Synchronize suggestions loading after the reconnect 2 (#9142) related #8689, #9072 Fixes a race between the language server SQL updating logic and the engine `DeserializeLibrarySuggestionsJob`s when the library suggestions may start loading before the database is properly cleaned up after the reconnect. # Important Notes As a side effect, arguments are showing slightly (~1 second) faster due to the lower contention between the engine jobs. #### Before https://github.com/enso-org/enso/assets/357683/cbda2da4-9080-4b9b-b836-81e54694d468 #### After https://github.com/enso-org/enso/assets/357683/bf442284-47be-456d-b1dd-2413b6ad8244 --- .../search/SearchProtocol.scala | 3 + .../search/SuggestionsHandler.scala | 86 +++++++++++++------ .../InvalidateModulesIndexHandler.scala | 18 +++- .../InvalidateModulesIndexCommand.java | 3 +- .../instrument/job/BackgroundJob.java | 11 +++ .../StartBackgroundProcessingCmd.scala | 3 +- .../DeserializeLibrarySuggestionsJob.scala | 2 +- .../searcher/sql/SqlSuggestionsRepo.scala | 5 +- 8 files changed, 94 insertions(+), 37 deletions(-) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/SearchProtocol.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/SearchProtocol.scala index a4c4a737abc3..5d636a34c71a 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/SearchProtocol.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/SearchProtocol.scala @@ -493,6 +493,9 @@ object SearchProtocol { updates: Seq[SuggestionsDatabaseUpdate] ) + /** A request to clear the suggestions database. */ + case object ClearSuggestionsDatabase + /** The request to receive contents of the suggestions database. */ case object GetSuggestionsDatabase diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala index 86e58510f5d1..ba5c85eca2ec 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/SuggestionsHandler.scala @@ -110,6 +110,8 @@ final class SuggestionsHandler( ) context.system.eventStream .subscribe(self, classOf[Api.LibraryLoaded]) + context.system.eventStream + .subscribe(self, classOf[Api.BackgroundJobsStartedNotification]) context.system.eventStream.subscribe(self, classOf[FileDeletedEvent]) context.system.eventStream .subscribe(self, InitializedEvent.SuggestionsRepoInitialized.getClass) @@ -186,13 +188,29 @@ final class SuggestionsHandler( case msg: Api.SuggestionsDatabaseSuggestionsLoadedNotification if state.isSuggestionLoadingRunning => - state.suggestionLoadingQueue.enqueue(msg) + logger.trace( + "SuggestionsDatabaseSuggestionsLoadedNotification [shouldStartBackgroundProcessing={}].", + state.shouldStartBackgroundProcessing + ) + if (state.shouldStartBackgroundProcessing) { + state.suggestionLoadingQueue.clear() + } else { + state.suggestionLoadingQueue.enqueue(msg) + } case msg: Api.SuggestionsDatabaseSuggestionsLoadedNotification => logger.debug( "Starting loading suggestions for library [{}].", msg.libraryName ) + context.become( + initialized( + projectName, + graph, + clients, + state.suggestionLoadingRunning() + ) + ) applyLoadedSuggestions(msg.suggestions) .onComplete { case Success(notification) => @@ -214,14 +232,6 @@ final class SuggestionsHandler( ) self ! SuggestionsHandler.SuggestionLoadingCompleted } - context.become( - initialized( - projectName, - graph, - clients, - state.suggestionLoadingRunning() - ) - ) case msg: Api.SuggestionsDatabaseModuleUpdateNotification if state.isSuggestionUpdatesRunning => @@ -304,39 +314,65 @@ final class SuggestionsHandler( ) ) + case Api.BackgroundJobsStartedNotification() => + self ! SuggestionLoadingCompleted + context.become( + initialized( + projectName, + graph, + clients, + state.backgroundProcessingStarted() + ) + ) + case GetSuggestionsDatabaseVersion => suggestionsRepo.currentVersion .map(GetSuggestionsDatabaseVersionResult) .pipeTo(sender()) - case GetSuggestionsDatabase => - val responseAction = for { - _ <- suggestionsRepo.clean - version <- suggestionsRepo.currentVersion - } yield GetSuggestionsDatabaseResult(version, Seq()) - - responseAction.pipeTo(sender()) - - val handlerAction = for { - _ <- responseAction - } yield SearchProtocol.InvalidateModulesIndex + case ClearSuggestionsDatabase => + if (state.isSuggestionLoadingRunning) stash() + else { + context.become( + initialized( + projectName, + graph, + clients, + state.suggestionLoadingRunning() + ) + ) + for { + _ <- suggestionsRepo.clean + } yield { + logger.trace( + "ClearSuggestionsDatabase [{}].", + state.suggestionLoadingQueue + ) + state.suggestionLoadingQueue.clear() + runtimeConnector ! Api.Request(Api.StartBackgroundProcessing()) + } + } + case GetSuggestionsDatabase => val handler = context.system.actorOf( InvalidateModulesIndexHandler.props( RuntimeFailureMapper(contentRootManager), timeout, - runtimeConnector + runtimeConnector, + self ) ) - handlerAction.pipeTo(handler) + handler ! SearchProtocol.InvalidateModulesIndex + + sender() ! GetSuggestionsDatabaseResult(0, Seq()) context.become( initialized( projectName, graph, clients, - state.backgroundProcessingStarted() + state.backgroundProcessingStopped() ) ) @@ -419,7 +455,8 @@ final class SuggestionsHandler( InvalidateModulesIndexHandler.props( runtimeFailureMapper, timeout, - runtimeConnector + runtimeConnector, + self ) ) action.pipeTo(handler)(sender()) @@ -450,6 +487,7 @@ final class SuggestionsHandler( ) case SuggestionLoadingCompleted => + unstashAll() if (state.suggestionLoadingQueue.nonEmpty) { self ! state.suggestionLoadingQueue.dequeue() } diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala index 899eb958de27..69e9dd2dacad 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/search/handler/InvalidateModulesIndexHandler.scala @@ -17,11 +17,13 @@ import scala.concurrent.duration.FiniteDuration * @param runtimeFailureMapper mapper for runtime failures * @param timeout request timeout * @param runtime reference to the runtime connector + * @param suggestionsHandler reference to the suggestions handler */ final class InvalidateModulesIndexHandler( runtimeFailureMapper: RuntimeFailureMapper, timeout: FiniteDuration, - runtime: ActorRef + runtime: ActorRef, + suggestionsHandler: ActorRef ) extends Actor with LazyLogging with UnhandledLogging { @@ -50,6 +52,7 @@ final class InvalidateModulesIndexHandler( context.stop(self) case Api.Response(_, Api.InvalidateModulesIndexResponse()) => + suggestionsHandler ! SearchProtocol.ClearSuggestionsDatabase replyTo ! SearchProtocol.InvalidateSuggestionsDatabaseResult cancellable.cancel() context.stop(self) @@ -67,14 +70,21 @@ object InvalidateModulesIndexHandler { * * @param runtimeFailureMapper mapper for runtime failures * @param timeout request timeout - * @param runtime reference to the runtime conector + * @param runtime reference to the runtime connector + * @param suggestionsHandler reference to the suggestions handler */ def props( runtimeFailureMapper: RuntimeFailureMapper, timeout: FiniteDuration, - runtime: ActorRef + runtime: ActorRef, + suggestionsHandler: ActorRef ): Props = Props( - new InvalidateModulesIndexHandler(runtimeFailureMapper, timeout, runtime) + new InvalidateModulesIndexHandler( + runtimeFailureMapper, + timeout, + runtime, + suggestionsHandler + ) ) } diff --git a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/command/InvalidateModulesIndexCommand.java b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/command/InvalidateModulesIndexCommand.java index 7edaa2710840..3e61838cacd7 100644 --- a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/command/InvalidateModulesIndexCommand.java +++ b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/command/InvalidateModulesIndexCommand.java @@ -5,7 +5,6 @@ import java.util.logging.Level; import org.enso.interpreter.instrument.execution.RuntimeContext; import org.enso.interpreter.instrument.job.DeserializeLibrarySuggestionsJob; -import org.enso.interpreter.instrument.job.StartBackgroundProcessingJob; import org.enso.interpreter.runtime.EnsoContext; import org.enso.polyglot.runtime.Runtime$Api$InvalidateModulesIndexResponse; import scala.Option; @@ -33,6 +32,7 @@ public Future executeAsynchronously(RuntimeContext ctx, ExecutionCont TruffleLogger logger = ctx.executionService().getLogger(); long writeCompilationLockTimestamp = ctx.locking().acquireWriteCompilationLock(); try { + ctx.jobControlPlane().stopBackgroundJobs(); ctx.jobControlPlane().abortBackgroundJobs(DeserializeLibrarySuggestionsJob.class); EnsoContext context = ctx.executionService().getContext(); @@ -48,7 +48,6 @@ public Future executeAsynchronously(RuntimeContext ctx, ExecutionCont return BoxedUnit.UNIT; }); - StartBackgroundProcessingJob.startBackgroundJobs(ctx); reply(new Runtime$Api$InvalidateModulesIndexResponse(), ctx); } finally { ctx.locking().releaseWriteCompilationLock(); diff --git a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/job/BackgroundJob.java b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/job/BackgroundJob.java index 3ecac0f03651..23bf01a84d45 100644 --- a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/job/BackgroundJob.java +++ b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/job/BackgroundJob.java @@ -22,6 +22,17 @@ public BackgroundJob(int priority) { this.priority = priority; } + /** + * Create a background job with priority. + * + * @param priority the job priority. Lower number indicates higher priority. + * @param mayInterruptIfRunning the flag indicating if the running job may be interrupted. + */ + public BackgroundJob(int priority, boolean mayInterruptIfRunning) { + super(List$.MODULE$.empty(), true, mayInterruptIfRunning); + this.priority = priority; + } + /** * @return the job priority. */ diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/command/StartBackgroundProcessingCmd.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/command/StartBackgroundProcessingCmd.scala index 5194accc483a..bde3651c8e37 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/command/StartBackgroundProcessingCmd.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/command/StartBackgroundProcessingCmd.scala @@ -19,8 +19,7 @@ final class StartBackgroundProcessingCmd( ctx: RuntimeContext, ec: ExecutionContext ): Future[Unit] = { - StartBackgroundProcessingJob.startBackgroundJobs() - Future.successful(()) + Future(StartBackgroundProcessingJob.startBackgroundJobs()) } } diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/DeserializeLibrarySuggestionsJob.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/DeserializeLibrarySuggestionsJob.scala index 7f9277f19bdb..2e1bbe71763e 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/DeserializeLibrarySuggestionsJob.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/DeserializeLibrarySuggestionsJob.scala @@ -14,7 +14,7 @@ import scala.jdk.CollectionConverters._ */ final class DeserializeLibrarySuggestionsJob( val libraryName: LibraryName -) extends BackgroundJob[Unit](DeserializeLibrarySuggestionsJob.Priority) +) extends BackgroundJob[Unit](DeserializeLibrarySuggestionsJob.Priority, true) with UniqueJob[Unit] { /** @inheritdoc */ diff --git a/lib/scala/searcher/src/main/scala/org/enso/searcher/sql/SqlSuggestionsRepo.scala b/lib/scala/searcher/src/main/scala/org/enso/searcher/sql/SqlSuggestionsRepo.scala index 62d9faae1882..457e8b7ad2c1 100644 --- a/lib/scala/searcher/src/main/scala/org/enso/searcher/sql/SqlSuggestionsRepo.scala +++ b/lib/scala/searcher/src/main/scala/org/enso/searcher/sql/SqlSuggestionsRepo.scala @@ -175,10 +175,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit /** The query to clean the repo. */ private def cleanQuery: DBIO[Unit] = { - for { - _ <- Suggestions.delete - _ <- SuggestionsVersion.delete - } yield () + DBIO.seq(Suggestions.delete, SuggestionsVersion.delete) } /** The query to get all suggestions. From a900fb5c4394150d0d727b8d87c6b9eac0239450 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 23 Feb 2024 11:19:35 +0000 Subject: [PATCH 03/26] Add docs to highlight order of processing dirty nodes in `readFunctionAst`. (#9141) --- app/gui2/src/stores/graph/graphDatabase.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/gui2/src/stores/graph/graphDatabase.ts b/app/gui2/src/stores/graph/graphDatabase.ts index 339efe4c2e83..e060cd0a2de5 100644 --- a/app/gui2/src/stores/graph/graphDatabase.ts +++ b/app/gui2/src/stores/graph/graphDatabase.ts @@ -325,6 +325,10 @@ export class GraphDb { } } + /** + * Note that the `dirtyNodes` are visited and updated in the order that they appear in the module AST, irrespective of + * the iteration order of the `dirtyNodes` set. + **/ readFunctionAst( functionAst_: Ast.Function, rawFunction: RawAst.Tree.Function, @@ -333,6 +337,8 @@ export class GraphDb { dirtyNodes: Set, ) { const functionChanged = functionAst_.id !== this.currentFunction + // Note: `subtrees` returns a set that has the iteration order of all `Ast.ID`s in the order they appear in the + // module AST. This is important to ensure that nodes are updated in the correct order. const knownDirtySubtrees = functionChanged ? null : subtrees(functionAst_.module, dirtyNodes) const subtreeDirty = (id: AstId) => !knownDirtySubtrees || knownDirtySubtrees.has(id) this.currentFunction = functionAst_.id From e7a922161822c84c5554ede4ff029d97b19d0e69 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 23 Feb 2024 13:10:45 +0100 Subject: [PATCH 04/26] Fix escaping `\` (#9155) Fixes #9151 In one of my previous PRs I merged two `escape` implementations having exactly the same documentation. However, one of it missed escaping `\` character. # Important Notes One test even expected that `\` are _not_ escaped, but I doubt it should, given the above bug report? --- .../src/util/ast/__tests__/abstract.test.ts | 17 ----------------- app/gui2/src/util/ast/__tests__/text.ts | 5 ++++- app/gui2/src/util/ast/text.ts | 5 +++-- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/app/gui2/src/util/ast/__tests__/abstract.test.ts b/app/gui2/src/util/ast/__tests__/abstract.test.ts index 517e8d851aa8..72b0b44d9d5f 100644 --- a/app/gui2/src/util/ast/__tests__/abstract.test.ts +++ b/app/gui2/src/util/ast/__tests__/abstract.test.ts @@ -508,23 +508,6 @@ test('Construct app', () => { expect(namedApp.code()).toBe('func name=arg') }) -test.each([ - ['Hello, World!', 'Hello, World!'], - ['Hello\t\tWorld!', 'Hello\\t\\tWorld!'], - ['He\nllo, W\rorld!', 'He\\nllo, W\\rorld!'], - ['Hello,\vWorld!', 'Hello,\\vWorld!'], - ['Hello, \\World!', 'Hello, \\World!'], - ['Hello, `World!`', 'Hello, ``World!``'], - ["'Hello, World!'", "\\'Hello, World!\\'"], - ['"Hello, World!"', '\\"Hello, World!\\"'], - ['Hello, \fWorld!', 'Hello, \\fWorld!'], - ['Hello, \bWorld!', 'Hello, \\bWorld!'], -])('Text literals escaping and unescaping', (original, expectedEscaped) => { - const escaped = escape(original) - expect(escaped).toBe(expectedEscaped) - expect(unescape(escaped)).toBe(original) -}) - test('Automatic parenthesis', () => { const block = Ast.parseBlock('main = func arg1 arg2') let arg1: Ast.MutableAst | undefined diff --git a/app/gui2/src/util/ast/__tests__/text.ts b/app/gui2/src/util/ast/__tests__/text.ts index 0a67ac6bb5f9..84211b7b176f 100644 --- a/app/gui2/src/util/ast/__tests__/text.ts +++ b/app/gui2/src/util/ast/__tests__/text.ts @@ -1,4 +1,5 @@ import * as astText from '@/util/ast/text' +import { unescape } from 'querystring' import { expect, test } from 'vitest' test.each([ @@ -6,5 +7,7 @@ test.each([ { string: '\t\r\n\v"\'`', escaped: '\\t\\r\\n\\v\\"\\\'``' }, { string: '`foo` `bar` `baz`', escaped: '``foo`` ``bar`` ``baz``' }, ])('`escape`', ({ string, escaped }) => { - expect(astText.escape(string)).toBe(escaped) + const result = astText.escape(string) + expect(result).toBe(escaped) + expect(unescape(escaped)).toBe(string) }) diff --git a/app/gui2/src/util/ast/text.ts b/app/gui2/src/util/ast/text.ts index 92ccaf65bec6..87bbce35a02c 100644 --- a/app/gui2/src/util/ast/text.ts +++ b/app/gui2/src/util/ast/text.ts @@ -7,6 +7,7 @@ const mapping: Record = { '\r': '\\r', '\t': '\\t', '\v': '\\v', + '\\': '\\\\', '"': '\\"', "'": "\\'", '`': '``', @@ -17,10 +18,10 @@ const reverseMapping = swapKeysAndValues(mapping) /** Escape a string so it can be safely spliced into an interpolated (`''`) Enso string. * NOT USABLE to insert into raw strings. Does not include quotes. */ export function escape(string: string) { - return string.replace(/[\0\b\f\n\r\t\v"'`]/g, (match) => mapping[match]!) + return string.replace(/[\0\b\f\n\r\t\v\\"'`]/g, (match) => mapping[match]!) } /** The reverse of `escape`: transform the string into human-readable form, not suitable for interpolation. */ export function unescape(string: string) { - return string.replace(/\\[0bfnrtv"']|``/g, (match) => reverseMapping[match]!) + return string.replace(/\\[0bfnrtv\\"']|``/g, (match) => reverseMapping[match]!) } From bdebe904b329d0f60521c96dbedc7b7de07f3e70 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Fri, 23 Feb 2024 23:41:58 +1000 Subject: [PATCH 05/26] Make `alt` key keep dropdown open (#9157) - Fix #9083 # Important Notes None --- .../src/components/GraphEditor/widgets/WidgetSelection.vue | 6 +++--- app/gui2/src/components/widgets/DropdownWidget.vue | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue index dafa63eae389..7c60187801f0 100644 --- a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue +++ b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue @@ -124,9 +124,9 @@ function toggleDropdownWidget() { showDropdownWidget.value = !showDropdownWidget.value } -function onClick(index: number) { +function onClick(index: number, keepOpen: boolean) { selectedIndex.value = index - showDropdownWidget.value = false + showDropdownWidget.value = keepOpen } // When the selected index changes, we update the expression content. @@ -181,7 +181,7 @@ export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, { :color="'var(--node-color-primary)'" :values="tagLabels" :selectedValue="selectedLabel" - @click="onClick($event)" + @click="onClick" /> diff --git a/app/gui2/src/components/widgets/DropdownWidget.vue b/app/gui2/src/components/widgets/DropdownWidget.vue index 950504abbb93..e2be7d6b0444 100644 --- a/app/gui2/src/components/widgets/DropdownWidget.vue +++ b/app/gui2/src/components/widgets/DropdownWidget.vue @@ -10,7 +10,7 @@ enum SortDirection { } const props = defineProps<{ color: string; selectedValue: string | undefined; values: string[] }>() -const emit = defineEmits<{ click: [index: number] }>() +const emit = defineEmits<{ click: [index: number, keepOpen: boolean] }>() const sortDirection = ref(SortDirection.none) @@ -51,11 +51,11 @@ const NEXT_SORT_DIRECTION: Record = {
    From d650798898f2c3c6d3c528b98af9b2da23434b18 Mon Sep 17 00:00:00 2001 From: Kaz Wesley Date: Fri, 23 Feb 2024 05:47:11 -0800 Subject: [PATCH 06/26] Display alias when searching by alias (#9148) * Display alias when searching by alias * Fix tests --- app/gui2/src/components/ComponentBrowser.vue | 10 ++---- .../__tests__/component.test.ts | 31 ++++--------------- .../components/ComponentBrowser/component.ts | 20 ++++++++++-- 3 files changed, 25 insertions(+), 36 deletions(-) diff --git a/app/gui2/src/components/ComponentBrowser.vue b/app/gui2/src/components/ComponentBrowser.vue index 6e2f4ef4aa20..60c3668d368f 100644 --- a/app/gui2/src/components/ComponentBrowser.vue +++ b/app/gui2/src/components/ComponentBrowser.vue @@ -419,10 +419,7 @@ const handler = componentBrowserBindings.handler({ :style="{ color: componentColor(item.component) }" /> - + - + -import ExecutionModeSelector from '@/components/ExecutionModeSelector.vue' - -const props = defineProps<{ title: string; modes: string[]; mode: string }>() -const emit = defineEmits<{ execute: []; 'update:mode': [mode: string] }>() - - - - - diff --git a/app/gui2/src/components/TopBar.vue b/app/gui2/src/components/TopBar.vue index 64583e29872e..70ae9973a696 100644 --- a/app/gui2/src/components/TopBar.vue +++ b/app/gui2/src/components/TopBar.vue @@ -1,13 +1,12 @@