[AVM Module Issue]: Not able to setup account throughput limit on CosmosDB Account level (Provisioned Capacity mode)

Check for previous/existing GitHub issues

[x] I have checked for previous/existing GitHub issues

Issue Type?
Feature Request
Module Name
avm/res/document-db/database-account
(Optional) Module Version
0.8.1
Description
When using CosmosDB AVM module, it is not possible to setup Account throughput limit when using Provisioned capacity mode.
See more about account throughput here: https://learn.microsoft.com/en-us/azure/cosmos-db/limit-total-account-throughput
This is possible in Azure portal:

and also in ARM template:

and Vanilla Bicep:

If not set it opens up account for unlimited throughput, so if overlooked it could cause additional costs for application workflows.
As the implementation is straight forward, it would be great to include it in the next release.
(Optional) Correlation Id
No response

Bump, any update on this please?

awesome, thanks

Thanks!

Hi there,
You have a naming issue here: you named the property "totalThrougputLimit" instead of "totalThroughputLimit". This is why capacity can not be set. Hm, is this actually tested!? You always mention that automation and so on, this would be easy to find, I would assume.
{
databaseAccountOfferType: databaseAccountOfferType
backupPolicy: backupPolicy
capabilities: capabilities
minimalTlsVersion: minimumTlsVersion
capacity: {
totalThrougputLimit [INCORRECT]: totalThroughputLimit [CORRECT]
}
}
I see still some other issues with your "database need to be there" concept and will propose something in separate ticket.


Audit and review all styles for the v2 Tailwind plugin

Per @AdrianGonz97 request, I'll run through all stylesheets and try to prune styles that are no longer relevant and fix any known issues as I go. This might even include a few minor additions.
This will need to happen on the v2 branch given the substantial changes to the location and structure of styles.

This was completed a couple weeks ago, just missed the ticket!


Only tracking 6 members

After using the plugin for about a week, it seems to have only tracked 6 members out of ~490.
I'm unsure if this is maybe a conflict with other plugins, but I do also use Clan Member List Sorting and Copy FC/CC users to clipboard.
I also multi-client with the same plugin configurations. Not sure if that matters.

After further investigation, it's 100% the multi-clienting. I guess because they're both trying to change the file at the same time, perhaps. Both accounts are in the same clan.

I was not really able to reproduce some of your bugs but ive added an option to use the rsn of the account you are logged in on as part of the filename, this will prevent any multi logging bugs (it was also double counting messages before).
Note that it only adds online people to the log at the moment. If you are still missing people in the log that are currently online you can try leaving and re-entering the fc/cc (yes you can leave a clan chat without fully leaving the clan).
I have just pushed this update to the Plugin Hub but it might be a day or so before the changes are added in the client.

Seems like I'm still getting the issue after the update. After a while the file just resets and starts from scratch. I'm not entirely sure what's causing it. I've been backing up the file and saving it elsewhere to keep in case of resets but yeah, for some reason, the file hits about 8kb and then just resets.

I've done a little more testing. I've backed up a file right before it resets. Any more data added to this file seems to reset it. So any chat messages, people logging in etc will reset the file back to a fresh file.
It's 9kb in size and for some reason has a random N at the bottom of the list.
Hallowed_RS_Touch Wood_Log1 - Before Error Log.csv
I've attached the file in case it helps at all but looks to me like after a certain file size the plugin seems to have issues writing more data or something along those lines.

Sorry to be a bother but is there any movement on this yet?


IndexOutOfBoundsException being dumped

Just had a look in my Surefire reports output directory and spotted the following:
target/surefire-reports/2022-12-30T14-01-27_616-jvmRun1.dumpstream
# Created at 2022-12-30T14:01:38.848
ForkStarter IOException: Index: 1, Size: 1.
org.apache.maven.plugin.surefire.booterclient.output.MultipleFailureException: Index: 1, Size: 1
	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.<init>(ThreadedStreamConsumer.java:64)
	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer.<init>(ThreadedStreamConsumer.java:122)
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:600)
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:311)
	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:268)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1334)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1167)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:931)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:210)
	at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:195)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)
	Suppressed: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
		at java.base/java.util.Collections$SingletonList.get(Collections.java:4959)
		at org.apache.maven.plugin.surefire.report.TreePrinter$TestPrinter.printClass(TreePrinter.java:162)
		at org.apache.maven.plugin.surefire.report.TreePrinter$TestPrinter.printTest(TreePrinter.java:96)
		at org.apache.maven.plugin.surefire.report.TreePrinter$TestPrinter.access$500(TreePrinter.java:85)
		at org.apache.maven.plugin.surefire.report.TreePrinter.lambda$printTests$1(TreePrinter.java:82)
		at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
		at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
		at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
		at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
		at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
		at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
		at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
		at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
		at org.apache.maven.plugin.surefire.report.TreePrinter.printTests(TreePrinter.java:82)
		at org.apache.maven.plugin.surefire.report.TestReportHandler.printTests(TestReportHandler.java:111)
		at org.apache.maven.plugin.surefire.report.TestReportHandler.print(TestReportHandler.java:44)
		at org.apache.maven.plugin.surefire.report.ConsoleTreeReporterBase.testSetCompleted(ConsoleTreeReporterBase.java:26)
		at org.apache.maven.plugin.surefire.report.ConsoleTreeReporterAscii.testSetCompleted(ConsoleTreeReporterAscii.java:32)
		at org.apache.maven.plugin.surefire.report.ConsoleTreeReporterBase.testSetCompleted(ConsoleTreeReporterBase.java:8)
		at org.apache.maven.plugin.surefire.report.TestSetRunListener.testSetCompleted(TestSetRunListener.java:213)
		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$TestSetCompletedListener.handle(ForkClient.java:147)
		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$TestSetCompletedListener.handle(ForkClient.java:135)
		at org.apache.maven.plugin.surefire.booterclient.output.ForkedProcessEventNotifier.notifyEvent(ForkedProcessEventNotifier.java:233)
		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:353)
		at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:59)
		at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:96)
		... 1 more

Tests appear to still be running, though. I don't know how serious this is or whether it is anything to worry about or not.

Other info:
Invocation: $ ./mvnw clean verify -T8
$ uname -a
Linux z170x-fedora 6.0.12-300.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 16:58:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ java -version
java -version
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment Corretto-<IP_ADDRESS>.1 (build 19.0.1+10-FR)
OpenJDK 64-Bit Server VM Corretto-<IP_ADDRESS>.1 (build 19.0.1+10-FR, mixed mode, sharing)

$ ./mvnw --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /home/ashley/.m2/wrapper/dists/apache-maven-3.8.6-bin/1ks0nkde5v1pk9vtc31i9d0lcd/apache-maven-3.8.6
Java version: 19.0.1, vendor: Amazon.com Inc., runtime: /home/ashley/.sdkman/candidates/java/19-amzn
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "6.0.12-300.fc37.x86_64", arch: "amd64", family: "unix"

<properties>
  <argLine>
    -Dorg.slf4j.simpleLogger.log=INFO
    -Xshare:off
  </argLine>

  <maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
  <maven-surefire-junit5-tree-reporter.version>1.1.0</maven-surefire-junit5-tree-reporter.version>
</properties>

<plugin>
  <!-- Unit testing config -->
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>${maven-surefire-plugin.version}</version>

  <configuration>
    <excludes>
      <exclude>*IntegrationTest</exclude>
    </excludes>

    <failIfNoTests>true</failIfNoTests>
    <runOrder>random</runOrder>
    <tempDir>./tmp/unit</tempDir>
    <useModulePath>true</useModulePath>

    <!--
      This block is needed to show @DisplayName and @ParameterizedTest
      in reports with the provided names.
    -->
    <statelessTestsetReporter
      implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
      <disable>false</disable>
      <version>3.0</version>
      <usePhrasedFileName>false</usePhrasedFileName>
      <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
      <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
      <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
    </statelessTestsetReporter>
    <consoleOutputReporter>
      <disable>${hide-test-logs-in-console}</disable>
    </consoleOutputReporter>
    <statelessTestsetInfoReporter
      implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
      <disable>false</disable>
      <usePhrasedFileName>false</usePhrasedFileName>
      <usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
      <usePhrasedClassNameInTestCaseSummary>true</usePhrasedClassNameInTestCaseSummary>
    </statelessTestsetInfoReporter>
  </configuration>

  <dependencies>
    <dependency>
      <groupId>me.fabriciorby</groupId>
      <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
      <version>${maven-surefire-junit5-tree-reporter.version}</version>
    </dependency>
  </dependencies>
</plugin>

src/test/resources/junit-platform.properties
junit.jupiter.execution.parallel.enabled=true

Since I am not sure of the conditions causing this issue, it is hard to make a minimal working reproduction. However, I seem to be able to reproduce this by in my project. Should be able to trigger it with:
$ git clone git@github.com:ascopes/java-compiler-testing
$ cd java-compiler-testing
$ git checkout 511f1e87d4ff6316ac8330bb800e16c707d83953
$ ./mvnw clean test -am -e -pl java-compiler-testing -T4

Since I am not sure of the conditions causing this issue, it is hard to make a minimal working reproduction. However, I seem to be able to reproduce this by in my project. Should be able to trigger it with:
$ git clone git@github.com:ascopes/java-compiler-testing
$ cd java-compiler-testing
$ git checkout 511f1e87d4ff6316ac8330bb800e16c707d83953
$ ./mvnw clean test -am -e -pl java-compiler-testing -T4

I followed these steps and I was not able to reproduce :/
Not so long ago I've opened an issue in the SUREFIRE Jira and for some reason it looks like that the  tag can change the behavior of how the tests are printed. (https://issues.apache.org/jira/browse/SUREFIRE-2111?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=17652515#comment-17652515)
Could you do a favor, please? Could you try to run the same test, but without the  and see what happens?

The first 15 or so times I tried this tonight, it seems to have not had the issue. I spotted one run after this that did have it and it would appear to be to do with the ordering of tests.
Looks like passing -Dsurefire.runOrder.random.seed=718860759208 to the Maven invocation makes this occur each time (might be a red herring, but one to try perhaps?)
Just about to try without exclude.

Without the exclude, it doesn't seem to do it with that above seed. Just rerunning a few runs with random order again as unsetting the <exclude> in my project will cause several integration tests to run which may mess with test ordering. Will also try and attach a debugger to see if I can get any info as to what it is processing when it fails and get back to you.

Ok, so I attached a debugger and I can see that testResult.getSourceName() is returning io.github.ascopes.jct.tests.unit.compilers.AbstractJctCompilerTest$TargetTests. The getTreeLength is going to return 1 from this, I assume.
The class results list itself only has the one element though:

...so the .get(1) is going to fail there.
I managed to debug this by creating mvnwDebug scripts (./mvnw wrapper:wrapper -DincludeDebug=true), and then running ./mvnwDebug -Dsurefire.runOrder.random.seed=718860759208 -T4 -pl java-compiler-testing -am test.
I attached a remote debugger on port 8000 from IntelliJ once I ran this, and added an exception break point on any IndexOutOfBoundsException getting raised. I then manually added the junit5-tree-reporter plugin to my POM while the debugger was running and instructed IntelliJ to refresh the project dependencies so I could get the source code for the plugin while the debugger stopped on it.
Looks like it definitely might be related to what you suggested. I am guessing this is making the assumption that the outer class runs tests before the inner class or something. The bit I am a bit confused on is that the data in classResults shows a completely different test class to the one in testResult.

Could it be a race condition somewhere perhaps?

Hey, thanks for all the effort with debugging!
I just discovered this issue with <exclude> 5 days ago, the ticket was raised exactly while I was developing some features in July. So using <exclude> is absolutely untested and will get problems with Parameterized and Nested tests (afaik).
Unfortunately, there's no easy fix and I will need some more time to analyze what can be done. Of course, you're very welcome to help if you want.

Cool, no worries. I may be able to look at some stuff at the weekend if I have time, so feel free to shout if there is anything in particular.

Could you do a favor, please? Could you try to run the same test, but without the  and see what happens?

FYI: I have this exact same error, but I don't have any <excludes />. I do have <includes /> explicitly though, so maybe that's different?
I'm using this reporter in a maven-failsafe-plugin configuration though, not a surefire one, but I think that plugin code is essentially the same.

Since the earlier referenced JIRA issue mentions something about @Nested classes, I tried a couple of times and I cannot reproduce it if I don't use the @Nested. I can reproduce it if I do use it, so that's a pointer of where it's going wrong.
Adding -Dfailsafe.excludes= or changing that configuration to have <excludes><exclude /></excludes> doesn't help by the way.
So I can reliably reproduce, but can't share the code as it is. I will try to debug it a bit as well.

I can't say I dove into it so much that I really understand everything that happening, but in the end it goes wrong in the following location:
https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter/blob/45484196182a1de41cbb5da699a24d7086d8da3a/src/main/java/org/apache/maven/plugin/surefire/report/TreePrinter.java#L232
Where treeLength is calculated here upon creation of the TreePrinter here:
https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter/blob/45484196182a1de41cbb5da699a24d7086d8da3a/src/main/java/org/apache/maven/plugin/surefire/report/TreePrinter.java#L257-L263
Again I didn't dive into it very deeply (don't have the time for that), but I don't understand why you would calculate your own treeLength based on the number of $ characters in the class name. Wouldn't it be roughly the same as just setting treeLength to classResults.size() - 1? Then you should be always safe or am I missing something?
-- twenty minutes later --
I'm probably missing something, there is a bunch more stuff that you do to make nested tests work correctly but apparently there are some assumptions about in what order nested classes are processed, which is not the case in this parallel scenario.
One pointer perhaps that might help you is that in this block of code:
https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter/blob/45484196182a1de41cbb5da699a24d7086d8da3a/src/main/java/org/apache/maven/plugin/surefire/report/TestReportHandler.java#L38-L45
I end up in the else case where it's failing whereas maybe you would have expected it to fall into the if.
--- some more time later ---
I give up for now. I'll leave this as a reference for which paths I have tried to debug, maybe it helps, maybe it doesn't. It seems like in the end there is a hidden assumption somewhere that if you have a @Nested class within another class that top level class will at least be done 'first', but this doesn't seem to be the case. So maybe it does indeed seem related to the JIRA issue mentioned earlier, but the workaround does work for me. In the end I'm running concurrent tests and it seems that JUnit has no issues running the nested class even before it has executed a test in the 'parent' class. Could that be the direction that you need to reproduce this scenario?
I fully realise that this is all open source and the work and I can't really expect you to fix it, but you have a better idea of where it might go wrong in that case. Obviously I'm grateful for the work you have put in, but if you find some time it would be awesome if this could be fixed for the greater community.

Another thing that I've noticed that is odd, is that when using this plugin and having @Disabled tests, those tests are duplicated in the output (?). Again just jotting it down here, because maybe it triggers something with the original author @fabriciorby...

hey @aukevanleeuwen, dank je wel voor jou hulp.
it's correct, there are many things I needed to just assume that would occur from the surefire part, or that I had to debug surefire in order to do it
oh yes, it's very annoying to debug this code, because it is attached in maven, and you have to debug the maven goal, in my small test suite it was working, but after it got slightly popular I realized there are many edge cases that are all screwed, and some I don't know if it's even possible to be fixed
thanks for spending a considerable time trying to figure it out, I really want to take some time and follow on these bugs
I was also wanting to rewrite it to be parsed in a better Tree data structure, the way it's right now is kind of gross, but the thing is it's been a long time and I also need some time to understand once again how this stuff works :/
but now it's summer time here in the Netherlands, I'll dig into it in some months when the weather gets depressive again
thanks again, it sparkled me some motivation

but now it's summer time here in the Netherlands, I'll dig into it in some months when the weather gets depressive again

Unfortunately the weather is indeed depressive again, so I was doing some investigation on @neewrobert PR (https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter/pull/58) and found some more insights that could help us:
I did a small analysis on NestedExampleTest output for timing
When running the tests in IntelliJ this was the outcome:

As we can see, the times are quite similar to what classResults prints to us. But there is one small catch, let's compare both directly in some kind of a table:

Class
Thread.sleep
Intellij Output
Maven Output

NestedSample (main test class)
1.600
1.630
1.671

NestedSample.Should pass (test)
100
105
114

NestedSample.Should pass2 (test)
500
507
507

NestedSample.InnerTest (class)
900
915
106

NestedSample.InnerTest.Should pass (test)
200
206
205

NestedSample.InnerTest.InnerTest (class)
700
709
932

NestedSample.InnerTest.InnerTest.Should pass (test)
300
304
305

NestedSample.InnerTest.InnerTest.InnerTest (class)
400
405
723

NestedSample.InnerTest.InnerTest.InnerTest.Should pass (test)
400
405
403

NestedSample.FirstInnerTest (class)
100
103
106

NestedSample.FirstInnerTest.ShouldPass (test)
100
103
105

As we can see, IntelliJ prints everything as expected but then the plugin does some weird thing while printing NestedSample.InnerTest (class) timing. But the tests timings are correct (from testResult)
I also noticed that the timing is the same as NestedSample.FirstInnerTest (class) and it could be that something got overwritten so I ran it again, but now changing its Thread.sleep to 600ms
After running the test it's possible to see the assumption was true.
[INFO] ├─ Nested Sample - 2.165 s
[INFO] │  ├─ ✔ Should pass - 0.113 s
[INFO] │  └─ ✔ Should pass2 - 0.507 s
[INFO] ├─ ┬─ Nested Sample Inner Test - 0.604 s
[INFO] │  │  └─ ✔ Inner test should pass - 0.202 s
[INFO] │  └─ ┬─ Nested Sample Inner Test Inner Inner Test - 0.929 s
[INFO] │     │  └─ ✔ Inner Inner Test should pass - 0.304 s
[INFO] │     └─ ┬─ Nested Sample Inner Test Inner Inner Test Inner Inner Inner Test - 0.720 s
[INFO] │        │  └─ ✔ Inner Inner Inner Test should pass - 0.402 s
[INFO] ├─ ── Nested Sample First Inner Test - 0.604 s
[INFO] │     └─ ✔ FirstInnerTest should show up - 0.602 s

As we can see, it's classResults.get(treeLength) points to NestedSample.FirstInnerTest (class), which king of makes sense (?) since they both have the same treeLength. I've missed this while developing, and I am also wondering if it has to do with the IndexOutOfBoundsException  we encounter in some cases.


Add details pane to Resources screen

The grid in the resources page is doing too much and it's creating problems:

There is a finite amount of horizontal screen real estate. We're struggling to put all the information we want in the grid.
Accessibility problems where clickable UI doesn't look like clickable UI.

The resources page details view should contain:

Summary information about the resource (stuff that is already in the grid)
Resource endpoints
Buttons to go to console logs and structured logs for the resource
Optional errors section. If there are unread structured logs (the number in the red circle on the resources grid) then a "notification section" is displayed that has the number of unread errors and a link to structured logs with the filter set to error (same link as the red circle on the resources grid)
Environment variables in a collapsable section

Changes to the grid:

Row should be clickable
Environment and logs buttons are removed
Unread error count is no longer clickable
PID/container ID removed? It's important information, but it would be available in the details view.

Dupe of https://github.com/dotnet/aspire/issues/1208


devspace build --push

Is your feature request related to a problem?
Yes, I want to build and push images without deploying to a cluster.
Which solution do you suggest?
devspace build --push or something similar
Which alternative solutions exist?
None that I know of, images seem to only be pushed on deploy.
Additional context
Also it seems like the caching fails if the deployment fails which means rebuilding every time I tweak until the deployment works.

How about just devspace build?

devspace build
Builds all defined images and pushes them


performance updates

Alaska Airlines Pull Request
Fixes: #41
Summary:
This PR addresses the following

Update browserlist configuration (complete)
Remove dependency on Github repo as a dependency (complete)

Type of change:
Please delete options that are not relevant.

[ ] New capability
[x] Revision of an existing capability
[ ] Infrastructure change (automation, etc.)
[ ] Other (please elaborate)

Checklist:

[x] My update follows the CONTRIBUTING guidelines of this project
[x] I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.
Thank you for your submission!
-- Auro Design System Team

Full discussion had in #41
Recommendation approved.

:tada: This PR is included in version 2.6.4 :tada:
The release is available on:

npm package (@latest dist-tag)
GitHub release

Your semantic-release bot :package::rocket:


Link Filtered Class Schedule Data to Class Schedule Card and Full Schedule View

Remove hard coded components in the Class Schedule Card and Full Schedule View. Link the data so that is transferred correctly

The issue is complete because the Class Schedule Card properly loads data from the scheduleData.


Include React Templates as ngReact directives?

Hey, I'm testing this project and just found React Templates and seems there's some useful ones like rt-repeat and similarly useful stuff. I was wondering if that could be included as a part of ngReact to use as drop-in replacements for AngularJS directives, like using rt-repeat instead of ng-repeat and automatically having the benefits of React rendering.
I would contribute to that but i'm still a bit alien to this project. Let me know if you guys can help me getting started with ngReact internals so that i can contribute or you also think it's a good idea and can work on that.
Best!

@alejandroiglesias it it sounds interesting, it is related to the discussion here #7 ?

@kasperp yes, it is indeed related. And what is being thought in that discussion is great, ie, the ability to do this:
<react-render>

{{x.name}}

</react-render>

and having React render that super-fast sounds like an awesome deal really.

I'll close this then


[FEA] Data loader: support to padding sparse sequential features on the left side

Is your feature request related to a problem? Please describe.
The PyT and TF Dataloader support padding list (sparse) features to the right, which means that shorter list sequences will be completed with 0s in the right.
For sequential recommendation, a common use case is to keep the last N user interactions, what can be done either in the preprocessing or in the model side. The NVT Slice op, supports truncating to the last N elements (by providing negative limits).
But it is also useful to be able to do additional truncation in the model side (e.g. truncating with larger max seq. threshold with Slice op and tuning the best max sequence length according to model accuracy and training speed. To do such truncation in the model side, the padding needs to be applied by the Data Loader on the left side of the sequence features, so that when they are converted to dense tensors the padding 0s are placed on the left side. Thus, features could be sliced in the model like feature[:, -keep_last_n:] without loosing the sequence features of users with less than N interactions.
Describe the solution you'd like
Create an argument for the datalodader sparse_padding_side, which by default is right, but can be set to left

I am assigned this, but I wanted to comment in addition, per CONTRIBUTING.md, and say that I have begun working on this.

Hello everyone, and @benfred @karlhigley @jperez999 in particular, since I see you have significant contributions to these test files,
Would you know, is there an existing unit test or tests that you can point me to that would be similar to a unit test to test and implement for this feature request? I have looked in test_torch_dataset.py, test_tf_dataset.py, test_dataloader_backend.py and the list_slice test in the test_ops.py test file. But I am not exactly sure currently what would be a good unit test template to test an implementation of adding right padding to the two framework dataloaders.
In particular, is there a unit test currently available for testing padding on the right, as mentioned in the issue by @gabrielspmoreira?
I did find def test_nested_list(): authored by @zhenwendai in test_tf_dataloader.py that has, for instance, pad_data_col = ..., but I am not sure whether this is testing padding in addition to loading nested list. Thank you.

Also @gabrielspmoreira, when you have a chance, would you be able to point me to where in the codebase the existing right padding can be specified? I have looked in the codebase and dataloader modules, but so far I have not been able to find this. I would like to add the sparse_padding_side argument at this point in the codebase, or someplace logically related.

@benfred @jperez999 @karlhigley I would like to see today, would you have any help, advice, or guidance on my comment above?

@gabrielspmoreira I want to see with you today, would you have any guidance or advice on my comment above?

Hey @lesnikow . I have created some time ago a preliminary version of the code that converts the internal NVTabular representation of sparse features (values, offsets) to sparse tensors and @jperez999 ported it and integrated in the NVTabular dataloader later.
To give an example, let's say a column in parquet file has sequence/list values, with 3 rows like this
[10,20]
[30]
[40,50,60]

The internal representation of NVTabular (values, offset) would be something like, as the offset informs how many values we have for each row
values = [10,20,30,40,50,60]
offsets = [2,1,3]

Then the equivalent sparse matrix can be build with values and indices like this
values = [10,20,30,40,50,60]
indices = [[0,0],
                 [0,1],
                 [1,0],
                 [2,0],
                 [2,1],
                 [2,2]

Finally the sparse tensor is converted to dense tensor  in this line, which is padded on the right. In this example I assume seq_limit=5 for this feature
[10. 20,  0,  0, 0]
[30,   0,  0,  0, 0]
[40. 50, 60, 0, 0]

To pad the items on the left, I believe we just need to substract the 2nd column of the indices for sparse matrix from the seq_limit ,so that it becomes
indices = [[0,4],
                 [0,3],
                 [1,4],
                 [2,4],
                 [2,3],
                 [2,2]

From the current implementation in NVTabular, I understand that the _get_indices() method is responsible to return the indices for each value.
So maybe including this code after this line (if padding_direction==True) can make the trick ;)
indices[:,1] = seq_limit - 1 - indices[:,1]

If we currently don't have tests for those data loader methods that converts the offset representation to sparse and dense features, it woud be good to create such tests using as test case something similar I have described here.

@gabrielspmoreira This is all very good to know, thank you. @gabrielspmoreira @jperez999 do you have a commit hash that you could point me to so that I can see and review this code change that you mention?

@gabrielspmoreira, when you have a chance, would you be able to point me to where in the codebase the existing right padding can be specified? I have looked in the codebase and dataloader modules, but so far I have not been able to find this. I would like to add the sparse_padding_side argument at this point in the codebase, or someplace logically related.

@gabrielspmoreira Would you have any insight or guidance on this?

Hey Adam. The user-facing class is the DataLoader. For example, in PyTorch it is the TorchAsyncItr class and in TF it is KerasSequenceLoader.
We should create an argument sparse_padding_side, which should accept 'right' (default) or 'right'.

@gabrielspmoreira I am wondering, is this current torch implementation at dd9927e sufficiently fast for your intended use case? I have used the approach that you suggested for sparse tensors in torch, but I had to modify it with a helper function. Just using the method you outlined would give
[0, 0, 0, 20, 10]
[0,  0,  0, 0, 30]
[0, 0, 0, 60, 50, 40]

instead of the desired
[0, 0, 0, 10, 20]
[0,  0,  0, 0, 30]
[0, 0, 0, 40, 50, 60]

In particular, the rows are in reversed order. I added the _build_sparse_tensor_helper_process_column() method to modify the indices to the correct order. This method does use a python while block. The current tensorflow implementation at that referenced commit uses tf operations, resulting in more speed-optimized code.
Hence is the current torch implementation with its python while block fast enough for your desired use case?
if not, do you have any ideas or approaches on how to use built-in torch.sparse class methods or other methods to make this more optimized or vectorized?
I have been working on doing this, but I have not been able to yet find a way. One of the current difficulties is that methods like torch.pad only operate on dense tensors, and only pads constant amounts, whereas we want to pad row-dependent amounts. A similar approach to the current tensorflow implementation would need something analogous to tensorflow's RaggedTensor class and its methods. There is a proposal to add the analogous NestedTensor class to torch, but this is only implemented in a separate package, and not part of torch proper.

@gabrielspmoreira Could you also clarify whether your intended padding would produce
[0, 0, 0, 10, 20]
[0, 0, 0, 0, 30]
[0, 0, 40, 50, 60]

or
[0, 0, 10, 20, 0]
[0, 0, 30, 0, 0]
[0, 0, 40, 50, 60]

In other words, is this feature for sliding each row all the way to right-side of the matrix, or to left-pad a constant amount on the left? The latter is significantly easier to implement, from what I have seen currently, than the former.


Two iframes with different dimensions on one page

Is it possible to have two iframes with different dimensions on one page?
I can specify the dimensions of the iframe with:
.mfp-iframe-holder .mfp-content {
	position: relative;
	background: #FFF;
	padding: 20px;
	width: 1280px;
	max-width: 1280px;
	height: 710px;
	margin: 20px auto;
}

But this will change the dimensions of all iframes at one page.
I have two links on one page and each link should open an iframe with a different dimensions.
In FancyBox I can specify the dimensions of every iframe with:
$(".fancybox1").fancybox({type: 'iframe', padding: 5, margin: 5, width: 1280, height: 710...
$(".fancybox2").fancybox({type: 'iframe', padding: 5, margin: 5, width: 800, height: 510...

But this doesn't work with Magnific Popup.

The only workaround I was able to find is to change the dimension of the iframe after it is launched:
$(document).ready(function() {
        $('.popup-iframe1').magnificPopup({
          disableOn: 1200,
          type: 'iframe',
          mainClass: 'mfp-fade',
          removalDelay: 160,
          preloader: false,
          fixedContentPos: false,
          callbacks: {
            open: function() {
              var objs = document.getElementsByClassName("mfp-content");
              if (objs.length > 0) {
              	var obj = objs[0];
              	obj.style.width = "1200px";
              	obj.style.maxWidth = "1200px";
              	obj.style.height = "706px";
              }
            },
            close: function() {
            }
          }
        });
});


Configure Azure Pipelines

This pipeline configuration builds the application and produces a build for the Release configuration.

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: mgguinne sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.


IOS PUSH notification onTap issue

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.3 21E230 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.71.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
ABLY version: 1.2.12 to 1.2.15
IOS App crash on tapping of notification.
Notification was tapped: Instance of 'RemoteMessage'

thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f1bfff0)
frame #0: 0x0000000192c0ae68 libsystem_malloc.dylib_malloc_zone_malloc libsystem_malloc.dylib_malloc_zone_malloc:
->  0x192c0ae68 <+0>:  stp    x24, x23, [sp, #-0x40]!
0x192c0ae6c <+4>:  stp    x22, x21, [sp, #0x10]
0x192c0ae70 <+8>:  stp    x20, x19, [sp, #0x20]
0x192c0ae74 <+12>: stp    x29, x30, [sp, #0x30]
Target 0: (Runner) stopped.

ikbalkaya
┆Issue is synchronized with this Jira Task by Unito

I am also facing same issue when I tap on notification

Hi @sohamprodt, this seems to have been a stale issue from nearly 2 years ago. I'm not sure if we've made improvements in this area (the fact that you're also seeing this issue implies we've not fixed it).
Can you share any more detail that would help us replicate this please?

Hi @umair-ably  thanks for reaching out. I have solved the error after a research. Thanks


ide style completions

#660
demo clip:

This is so cool! Would it be possible to also show descriptions for each value when that particular value is highlighted? (like how IDEs show you doc comments when you go to a particular function)

yes im planing to implement it like inshellisense
so a description box to the right (or the left depending on how much space is available)

wow, that looks super cool! nice work!

is there an easy way to add descriptions to a completer?
i cant find any way to do so. is that not implemented yet?

is there an easy way to add descriptions to a completer? i cant find any way to do so. is that not implemented yet?

Seems like one of the types of completers has value and description.

This is how I've enabled this in nushell
menu
  {
    name: commands_menu
    only_buffer_difference: false
    marker: "# "
    type: {
      layout: columnar
      columns: 4
      col_width: 20
      col_padding: 2
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      scope commands
      | where name =~ $buffer
      | each { |it| {value: $it.name description: $it.usage} }
    }
  }

keybinding
  {
    name: commands_menu
    modifier: control
    keycode: char_t
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: commands_menu }
  }

that seems to be nushell specific.
reedlines default completer doesnt seem to have that implemented
i guess for testing purposes i can just add the descriptions in the menu

I don't think nushell could have a menu on its own if reedline didn't support it. You can see here that the Suggestion struct supports a value and description.
https://github.com/nushell/reedline/blob/aa101f4d697dfebc886cd233e6a92d8957c27ca1/src/completion/base.rs#L56-L71
Nushell has this "convert_to_suggestion" function that may help if there's no example of how to do it in reedline itself.
https://github.com/nushell/nushell/blob/42bb42a2e1718469133fe3a71ac76c40389bbb30/crates/nu-cli/src/menus/menu_completions.rs#L76-L162

yes i have seen this, but the DefaultCompleter in reedline always returns None as description
https://github.com/nushell/reedline/blob/aa101f4d697dfebc886cd233e6a92d8957c27ca1/src/completion/default.rs#L99-L105
reedline does support it, but the DefaultCompleter doesnt
so im just inserting some dummy values in the complete function for testing

so i implemented descriptions like this

i made a enum to control where the description box shows up
https://github.com/maxomatic458/reedline/blob/94b7ebe829249c0ee3699b527ff90308bf7a258d/src/menu/ide_menu.rs#L9-L17
i also added an optional border

should i add checks to make sure that the description or completion has a valid size? (maybe cut off some stuff if it doesnt fit)
Im asking because the other menus dont have any checks for that

I thought there was a limit or it wrapped or something?

i added that for the description box currently
but not for the completions
i guess ill cut of strings that dont fit.
the list & column menus dont seem to check for that

maybe truncate with ... indicating that they were truncated?

@maxomatic458 Do you have time to clean up these CI errors?

@fdncred i will once im done, i marked it as draft again, i decided i want to change some stuff (more user input validation)

Ah, ok. We just made a nushell release and we like to land things like this early after a release to give us time to test it. Not rushing you, just explaining how we usually work.

yay, it's green. are you happy with what you have here?

@fdncred yep, should be done now

This PR is pretty benign. It's adding something new. I'm anxious to see a PR in nushell to enable this somehow. testing this now but I don't see an example with description. Is there something I have to do to enable that or is there just not one yet? Also, maybe I'm just missing them, but I don't see any tests. We've found that if you want to not break something in the future, it's good to have tests that demonstrate positive and negative responses. If you can add some tests and and example with descriptions (assuming that still works), i'll land this PR.

@fdncred i didnt find a way to add completions in reedline alone. for testing i manually inserted some here https://github.com/nushell/reedline/blob/0c5f9817465df3c80e062dd1b5b05bdd91924b83/src/completion/default.rs#L102-L108
and i also tested this menu in nushell.
the completion logic is basically just copied over from the column menu (wouldn't make sense to add tests here)
i could add a test for this function https://github.com/maxomatic458/reedline/blob/d4c00e0859bbcbe0429753b02c9b4adbf10a9310/src/menu/ide_menu.rs#L1040-L1108
but not really sure where else i could add them.
the only real other thing that could fail is that the menu doesnt render correctly and im not sure how this could be tested properly

if you don't mind, we'd like to have a much tested as possible, even if it's just a few things. the more testing the more stable the feature will be.

should i copy over the completion tests from the column menu as well (and just replace the menu with the ide menu)? i didnt touch the completion logic, but i guess it probably doesnt hurt to have them.

should i copy over the completion tests from the column menu as well

if that works and exercises your new menu, i'm fine with it.

looking good. ping me when you're ready to land this. i'm anxious to play with it in nushell.

@fdncred i think im ready. here is my nushell fork where you can try out the new menu.
the reedline example still doesn't include descriptions, as that would require either changing the default completer, or adding a new one. which should probably be done in a seperate PR.

here is an example menu entry for the config.nu file
    {
      name: completion_menu
      only_buffer_difference: false
      marker: "| "
      type: {
          layout: ide
          border: true
      }
      style: {
          text: green
          selected_text: green_reverse
          description_text: yellow
      }
    }

I tried your branch out and the completion list jumps around. I'm wondering if it has something to do with my prompt indicator being on a new line or something?

@fdncred hmm...
Shouldn't be caused by that (mine is also on a new line), ill try to see if i can replicate this

if you watch the gif, i did notice that the | str starts on the prompt line instead of on the indicator line. all completions may do that, not sure, i just noticed it here.
if it's any help, this is how my prompt is setup
# prompt
use modules\prompt\oh-my.nu git_prompt
$env.PROMPT_COMMAND = {|| (git_prompt).left_prompt }
$env.PROMPT_COMMAND_RIGHT = {|| (git_prompt).right_prompt }
$env.PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi green_bold)\n❯ (ansi reset)"} else {$"(ansi red_bold)\n❯ (ansi reset)"}}
$env.TRANSIENT_PROMPT_COMMAND = ""
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| (git_prompt).right_prompt }
$env.TRANSIENT_PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi light_yellow_bold)❯ (ansi reset)"} else {$"(ansi light_red_bold)❯ (ansi reset)"}}

and the use path above points to my local nu_scripts repo.

@fdncred
im experiencing the same problem when using the latest version of nushell (the official repo, with a columnar menu and your prompt settings).
Maybe its because of https://github.com/nushell/nushell/pull/11488

maybe? @ysthakur any thoughts on this?

@fdncred I think the reason the | str isn't on a new line is because the marker for your completion menu doesn't have a newline preceding it. Does your columnar menu's config have marker: "\n| " rather than "| " maybe?
As for the jumping around, I don't think https://github.com/nushell/nushell/pull/11488 would cause a change to the prompt, only to the returned suggestions (and their spans), but it's possible something I did in #700 messes with the way the prompt is printed (although the changes there should only be applicable when the buffer can't fit on your screen). I'll investigate further later today

marker: "\n| "
will show it on the correct line, but without any marker at all.
anything after the newline seems to get ignored.

@maxomatic458 Ah, I think that's because when figuring out the starting row to print the menu at, the painter doesn't consider that the menu's indicator may have newlines (but the prompt indicator is taken into account). In that case, I don't know how fdncred's config manages to keep the prompt on the second line when completing with a regular columnar menu.

so this cursor jumping when triggering a completion is not intended?
so should i wait until this gets sorted out?

I'm less concerned about | ls showing on the prompt vs indicator line but I'm more concerned about the entire menu jumping from the left to the right. That's the problem we need to solve.

@ysthakur I'm just using the suggested ide menu here https://github.com/nushell/reedline/pull/696#issuecomment-1889780555 and using @maxomatic458's nushell repo here https://github.com/nushell/reedline/pull/696#issuecomment-1889777321

@fdncred I was curious what configuration you normally use for your menu, because I tried copying your prompt configuration and using it with the regular columnar menu, and I still got the issue with | ls showing up on the first line instead of the second, with the second line being blank. I realize now it's probably not related to the jumping issue though

Here's my config.nu. Lots of debug and testing stuff.
# version output to markdown
def nuvermd [] { version | transpose key value | to md }
# version output to nushell table
def nuver [] { version | transpose key value }
# use pbcopy on macos to copy to clipboard
alias clip = pbcopy
# ls with colors, icons and grid
def lsg [] { ls | sort-by type name -i | grid -c }
# figure out how many lines are in code with tokei
def tok [] {
    tokei | lines | skip 1 | str join "\n" | detect columns |
    where Language !~ "=" and Language !~ "-" and Language !~ '\(' |
    into int Files Lines Code Comments Blanks
}

#alias for lazygit
alias lg = lazygit

# alias lvim = ^/Users/fdncred/.local/bin/lvim
# exec -a "$NVIM_APPNAME" nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@"

def path_underline [color: string] {
    {|p| if ($p | path exists) {
            $color + "_underline"
        } else {
            $color
        }
    }
}

def is_alias [cmd: string] {
    $cmd in (scope aliases | get name)
}

# # abbreviation for git status
# alias gst = git status
# # List all local branches
# alias gb = git branch
# Fix vi mistakes
alias vi = nvim
# Fix vim mistakes
alias vim = nvim

# alias gfu = git fetch upstream
# alias gmum = git merge upstream/main
# alias gpom = git push origin main
# alias gcom = git checkout main

# long listing
alias ll = ls -l

# region: Themes

# attributes
# code	meaning
# l	    blink
# b	    bold
# d	    dimmed
# h	    hidden
# i	    italic
# r	    reverse
# s	    strikethrough
# u	    underline
# n	    nothing
# defaults to nothing

# let base00 = "#181818" # Default Background
# let base01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks)
# let base02 = "#383838" # Selection Background
# let base03 = "#585858" # Comments, Invisibles, Line Highlighting
# let base04 = "#b8b8b8" # Dark Foreground (Used for status bars)
# let base05 = "#d8d8d8" # Default Foreground, Caret, Delimiters, Operators
# let base06 = "#e8e8e8" # Light Foreground (Not often used)
# let base07 = "#f8f8f8" # Light Background (Not often used)
# let base08 = "#ab4642" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
# let base09 = "#dc9656" # Integers, Boolean, Constants, XML Attributes, Markup Link Url
# let base0a = "#f7ca88" # Classes, Markup Bold, Search Text Background
# let base0b = "#a1b56c" # Strings, Inherited Class, Markup Code, Diff Inserted
# let base0c = "#86c1b9" # Support, Regular Expressions, Escape Characters, Markup Quotes
# let base0d = "#7cafc2" # Functions, Methods, Attribute IDs, Headings
# let base0e = "#ba8baf" # Keywords, Storage, Selector, Markup Italic, Diff Changed
# let base0f = "#a16946" # Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>

# let base16_theme = {
#   separator: $base03
#   leading_trailing_space_bg: $base04
#   header: $base0b
#   date: $base0e
#   filesize: $base0d
#   row_index: $base0c
#   bool: $base08
#   int: $base0b
#   duration: $base08
#   range: $base08
#   float: $base08
#   string: $base04
#   nothing: $base08
#   binary: $base08
#   cellpath: $base08

#   # shape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red
#   # but i like the regular white on red for parse errors
#   shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
#   shape_bool: $base0d
#   shape_int: { fg: $base0e attr: b}
#   shape_float: { fg: $base0e attr: b}
#   shape_range: { fg: $base0a attr: b}
#   shape_internalcall: { fg: $base0c attr: b}
#   shape_external: $base0c
#   shape_externalarg: { fg: $base0b attr: b}
#   shape_literal: $base0d
#   shape_operator: $base0a
#   shape_signature: { fg: $base0b attr: b}
#   shape_string: $base0b
#   shape_filepath: $base0d
#   shape_globpattern: { fg: $base0d attr: b}
#   shape_variable: $base0e
#   shape_flag: { fg: $base0d attr: b}
#   shape_custom: {attr: b}
#   shape_matching_brackets: { attr: u }
# }

let my_theme = {
  binary: red
  bool: {|| if $in { 'light_cyan' } else { 'light_red' } }
  cellpath: cyan
  date: {|| (date now) - $in |
    if $in < 1hr {
      'red3b' #"\e[38;5;160m" #'#e61919' # 160
    } else if $in < 6hr {
      'orange3' #"\e[38;5;172m" #'#e68019' # 172
    } else if $in < 1day {
      'yellow3b' #"\e[38;5;184m" #'#e5e619' # 184
    } else if $in < 3day {
      'chartreuse2b' #"\e[38;5;112m" #'#80e619' # 112

      } else if $in < 1wk {
      'green3b' #"\e[38;5;40m" #'#19e619' # 40
    } else if $in < 6wk {
      'darkturquoise' #"\e[38;5;44m" #'#19e5e6' # 44
    } else if $in < 52wk {
      'deepskyblue3b' #"\e[38;5;32m" #'#197fe6' # 32
    } else { 'dark_gray' }
  }

  duration: blue_bold
  filesize: {|e| if $e == 0b { 'white' } else if $e < 1mb { 'blue' } else { 'cyan' } }
  float: red
  header: gb
  hints: dark_gray
  int: green
  leading_trailing_space_bg: {bg: dark_gray_dimmed}
  nothing: red
  range: purple
  row_index: cb
  separator: purple
#   string: { if $in =~ '^#\w{6}$' { $in } else { 'white' } }
  string: {|| if $in =~ '^#[a-fA-F\d]+' { $in } else { 'white' } }
  search_result: {bg: red fg: white}
#   search_result: blue_reverse

  shape_and: purple_bold
  shape_binary: purple_bold
  shape_block: "#33ff00"
  shape_bool: light_cyan
  shape_closure: "#ffb000"
  shape_custom: green
  shape_datetime: cyan_bold
  shape_directory: cyan
  shape_external: darkorange
  shape_externalarg: green_bold
  shape_external_resolved: light_yellow_bold
  shape_filepath: cyan
  shape_flag: blue_bold
  shape_float: purple_bold
  # shapes are used to change the cli syntax highlighting
  shape_garbage: { fg: white bg: red attr: b}
  shape_globpattern: cyan_bold
  shape_int: purple_bold
  shape_internalcall: cyan_bold
  shape_keyword: cyan_bold
  shape_list: cyan_bold
  shape_literal: blue
  shape_match_pattern: green
  shape_matching_brackets: { attr: u }
#    shape_matching_brackets: { fg: red bg: default attr: b }
  shape_nothing: light_cyan
  shape_operator: yellow
  shape_or: purple_bold
  shape_pipe: purple_bold
  shape_range: yellow_bold
  shape_record: cyan_bold
  shape_redirection: purple_bold
  shape_signature: green_bold
  shape_string: green
  shape_string_interpolation: cyan_bold
  shape_table: blue_bold
  shape_variable: purple
  shape_vardecl: purple
}

# For more information on themes, see
# https://www.nushell.sh/book/coloring_and_theming.html
let dark_theme = {
    # color for nushell primitives
    separator: white
    leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
    header: green_bold
    empty: blue
    # Closures can be used to choose colors for specific values.
    # The value (in this case, a bool) is piped into the closure.
    bool: {|| if $in { 'light_cyan' } else { 'light_red' } }
    int: white
    filesize: {|e|
      if $e == 0b {
        'white'
      } else if $e < 1mb {
        'cyan'
      } else { 'blue' }
    }
    duration: white
    date: {|| (date now) - $in |
      if $in < 1hr {
        'red3b'
      } else if $in < 6hr {
        'orange3'
      } else if $in < 1day {
        'yellow3b'
      } else if $in < 3day {
        'chartreuse2b'
      } else if $in < 1wk {
        'green3b'
      } else if $in < 6wk {
        'darkturquoise'
      } else if $in < 52wk {
        'deepskyblue3b'
      } else { 'dark_gray' }
    }
    range: white
    float: white
    string: white
    nothing: white
    binary: white
    cellpath: white
    row_index: green_bold
    record: white
    list: white
    block: white
    hints: dark_gray

    shape_and: purple_bold
    shape_binary: purple_bold
    shape_block: blue_bold
    shape_bool: light_cyan
    shape_custom: green
    shape_datetime: cyan_bold
    shape_directory: cyan
    shape_external: cyan
    shape_externalarg: green_bold
    shape_filepath: cyan
    shape_flag: blue_bold
    shape_float: purple_bold
    # shapes are used to change the cli syntax highlighting
    shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
    shape_globpattern: cyan_bold
    shape_int: purple_bold
    shape_internalcall: cyan_bold
    shape_list: cyan_bold
    shape_literal: blue
    shape_match_pattern: green
    shape_matching_brackets: { attr: u }
    shape_nothing: light_cyan
    shape_operator: yellow
    shape_or: purple_bold
    shape_pipe: purple_bold
    shape_range: yellow_bold
    shape_record: cyan_bold
    shape_redirection: purple_bold
    shape_signature: green_bold
    shape_string: green
    shape_string_interpolation: cyan_bold
    shape_table: blue_bold
    shape_variable: purple
}
# endregion

# region: External Completers
# let external_completer = {|spans|
#   {
#     $spans.0: {carapace $spans.0 nushell $spans | from json } # default
#   } | get $spans.0 | each {|it| do $it}
# }

# let external_completer = {|spans|
# {
#   $spans.0: {carapace $spans.0 nushell $spans | from json } # default
#   "empty": { "[]" | from json } # no result (valid json)
#   "unknown": { "" | from json } # default file completion (invalid json)
#   "vals": { '["a", "b", "c"]' | from json } # external completion (valid json)
#   } | get $spans.0 | each {|it| do $it}
# }
# let fish_completer = {|spans|
#   fish --command $'complete "--do-complete=($spans | str join " ")"'
#   | str trim | split row "\n" | each { |line| $line | split column "\t" value description } | flatten
# }

# latest external completers from the cookbook 7/18/2023
# let carapace_completer = {|spans|
#     carapace $spans.0 nushell $spans | from json
# }

let fish_completer = {|spans|
    fish --command $'complete "--do-complete=($spans | str join " ")"'
    | $"value(char tab)description(char newline)" + $in
    | from tsv --flexible --no-infer
}

let zoxide_completer = {|spans|
    $spans | skip 1 | zoxide query -l $in | lines | where {|x| $x != $env.PWD}
}

let carapace_completer = {|spans: list<string>|
    carapace $spans.0 nushell $spans
    | from json
    | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
}

let multiple_completers = {|spans|
    let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion)

    let spans = (if $expanded_alias != null  {
        $spans | skip 1 | prepend ($expanded_alias | split words)
    } else { $spans })

    # match spans.0 {
    #     "z" | "zi" => $zoxide_completer
    #     "nu" => $fish_completer
    #     "git" => $carapace_completer
    #     _ => $carapace_completer
    # }

    {
      # zoxide alias
      z: $zoxide_completer

      # zoxide alias
      zi: $zoxide_completer

      # carapace completions are incorrect for nu
      nu: $fish_completer

      # fish completes commits and branch names in a nicer way
      git: $fish_completer
    } | get -i $spans.0 | default $carapace_completer | do $in $spans # use carapace as default
}

# endregion

# region: Config
$env.config = {
  show_banner: true # true or false to enable or disable the banner

  ls: {
    use_ls_colors: true # use the LS_COLORS environment variable to colorize output
    clickable_links: true # true or false to enable or disable clickable links in the ls listing. your terminal has to support links.
  }

  rm: {
    always_trash: true # always act as if -t was given. Can be overridden with -p
  }

  table: {
    mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
    index_mode: always #  "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
    show_empty: false # show 'empty list' and 'empty record' placeholders for command output
    trim: {     # A strategy of managing table view in case of limited space.
      methodology: wrapping # truncating or wrapping
      wrapping_try_keep_words: true
      # A suffix which will be used with 'truncating' methodology
      truncating_suffix: "…" # "⋯" "︙"
    }
    header_on_separator: true # show header text on separator/border line
    padding: {left: 1, right: 1} # int or record {left: 0 right: 0}
  }
  history: {
    max_size: 1_000_000 # Session has to be reloaded for this to take effect
    sync_on_enter: true # Enable to share the history between multiple sessions, else you have to close the session to persist history to file
    file_format: sqlite # "sqlite" or "plaintext"
    isolation: false # true enables history isolation, false disables it. history_isolation is a unique history per session.
  }
  completions: {
    case_sensitive: false # set to true to enable case-sensitive completions
    quick: true # set this to false to prevent auto-selecting completions when only one remains
    partial: true # set this to false to prevent partial filling of the prompt
    algorithm: "prefix" # prefix, fuzzy
    external: {
      enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow
      max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
    #   completer: $multiple_completers
      completer: null
    }
  }
  filesize: {
    metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
    format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
  }
  cursor_shape: {
    emacs: line
    vi_insert: block
    vi_normal: underscore
  }
#   datetime_format: {
#     # normal: "%Y-%m-%d %H:%M:%S"
#     normal: "%F %r"
#     # table: "%Y-%m-%d %H:%M:%S"
#     # table: "%b %d %Y %I:%M:%S %p"
#     # table: "%s"
#     # table: "%F %r"
#     table: "%x %r"
#   }

  datetime_format: {
    # normal: '%a, %d %b %Y %H:%M:%S %z'  # shows up in displays of variables or other datetime's outside of tables
    # table: '%m/%d/%y %I:%M:%S%p'        # generally shows up in tabular outputs such as ls
  }
  error_style: fancy
  color_config: $my_theme
  use_grid_icons: true
  footer_mode: 5 #always, never, number_of_rows, auto
  float_precision: 2
  buffer_editor: "hx" # command that will be used to edit the current line buffer with ctr+e
  use_ansi_coloring: true
  bracketed_paste: true # enable bracketed paste, currently useless on windows
  edit_mode: emacs # emacs, vi
  shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
  render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
  use_kitty_protocol: true # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this
  highlight_resolved_externals: true

  explore: {
    config: {
        cursor_color: 'red'
    }
    table: {
        selected_cell: { bg: 'blue'}
        show_cursor: false
    }
    try: {
        reactive: true
    }
  }

  hooks: {
    pre_prompt: [{||
      #if (shells | length) > 1 { tabline-hook }
      null
      #print -n "pre_p " (date now | format date "%Y-%m-%d %H:%M:%S.%f") (char nl)
      #if "LAST_CMD" in $env {
      #  print $"(ansi title)(pwd | str replace "/Users/fdncred" "~") > ($env.LAST_CMD)(ansi st)"
      #} else {
      #  print $"(ansi title)(pwd | str replace "/Users/fdncred" "~")(ansi st)"
      #}
    }]
    pre_execution: [{||
      null
      # $env.LAST_CMD = (commandline)
      #print -n "pre_e " (date now | format date "%Y-%m-%d %H:%M:%S.%f") (char nl)
    }]
    env_change: {
      PWD: [
      { |before, after|
        #print $"before: [($before)], after: [($after)]"
        # print ($env.LS_COLORS)
        print (lsg)
        # null
      },
      {
        condition: {|_, after| not ($after | path join 'toolkit.nu' | path exists)}
        code: "hide toolkit"
        # code: "overlay hide --keep-env [ PWD ] toolkit"
      },
      {
        condition: {|_, after| $after | path join 'toolkit.nu' | path exists}
        code: "
        print $'(ansi default_underline)(ansi default_bold)toolkit(ansi reset) module (ansi green_italic)detected(ansi reset)...'
        print $'(ansi yellow_italic)activating(ansi reset) (ansi default_underline)(ansi default_bold)toolkit(ansi reset) module with `(ansi default_dimmed)(ansi default_italic)use toolkit.nu(ansi reset)`'
        use toolkit.nu
        # overlay use --prefix toolkit.nu
        "
      },
      {|before, _|
        if $before == null {
            let file = ($nu.home-path | path join ".local" "share" "nushell" "startup-times.nuon")
            if not ($file | path exists) {
                mkdir ($file | path dirname)
                touch $file
            }
            let ver = (version)
            open $file | append {
                date: (date now)
                time: $nu.startup-time
                build: ($ver.build_rust_channel)
                allocator: ($ver.allocator)
                version: ($ver.version)
                commit: ($ver.commit_hash)
                build_time: ($ver.build_time)
            } | save --force $file
        }
      }
      ]
    }
    # display_output: {
    #   if (term size).columns > 100 { table -e } else { table }
    # #   table
    # }
    # display_output: {
    #   $env.__ = $in;
    #   print $env.__;
    # }
    display_output: { table } # run before the output of a command is drawn, example: `{ if (term size).columns >= 100 { table -e } else { table } }`
    command_not_found: {||
      null  # replace with source code to return an error message when a command is not found
    }
  }
  # old timey crt colors
  #   #ffb000 <- 600nm P3 <--history_menu
  #   #ffcc00 <- 593nm
  #   #33ff00 <- 524nm <-- completion_menu
  #   #33ff33 <- P1
  #   #00ff33 <- 506nm
  #   #66ff66 <- P24
  #   #00ff66 <- 502nm
  #   #282828 <- background

  # log_level: trace
  # region: Menus
  menus: [
  # Configuration for default nushell menus
  # Note the lack of souce parameter
  {
    name: completion_menu
    only_buffer_difference: false
    marker: $"(char -u '1f4ce') "
    type: {
      layout: columnar
      columns: 4
      col_width: 20   # Optional value. If missing all the screen width is used to calculate column width
      col_padding: 2
    }
    style: {
      text: { fg: "#33ff00" }
      selected_text: { fg: "#0c0c0c" bg: "#33ff00" attr: b}
      description_text: yellow
    }
  }
  {
    name: history_menu
    only_buffer_difference: true
    marker: $"(char -u '1f50d') "
    type: {
      layout: list
      page_size: 10
    }
    style: {
      text: "#ffb000"
      selected_text: { fg: "#ffb000" attr: r }
      description_text: yellow
    }
  }
  {
    name: help_menu
    only_buffer_difference: true
    marker: "? "
    type: {
      layout: description
      columns: 4
      col_width: 20   # Optional value. If missing all the screen width is used to calculate column width
      col_padding: 2
      selection_rows: 4
      description_rows: 10
    }
    style: {
      text: "#7F00FF"
      selected_text: { fg: "#ffff00" bg: "#7F00FF" attr: b }
      description_text: "#ffff00"
    }
  }
  # Example of extra menus created using a nushell source
  # Use the source field to create a list of records that populates
  # the menu
  {
    name: fzf_history_menu_fzf_ui
    only_buffer_difference: false
    marker: "# "
    type: {
      layout: columnar
      columns: 4
      col_width: 20
      col_padding: 2
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      open $nu.history-path | get history.command_line
      | to text | fzf +s --tac | str trim
      | where $it =~ $buffer
      | each { |v| {value: ($v | str trim) } }
    }
  }
  {
    name: fzf_menu_nu_ui
    only_buffer_difference: false
    marker: "# "
    type: {
      layout: list
      page_size: 10
    }
    style: {
      text: "#66ff66"
      selected_text: { fg: "#66ff66" attr: r }
      description_text: yellow
    }
    source: { |buffer, position|
      open $nu.history-path | get history.command_line
      | to text
      | fzf -f $buffer
      | lines
      | each { |v| {value: ($v | str trim) } }
    }
  }
  {
    name: commands_menu
    only_buffer_difference: false
    marker: "# "
    type: {
      layout: columnar
      columns: 4
      col_width: 20
      col_padding: 2
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      scope commands
      | where name =~ $buffer
      | each { |it| {value: $it.name description: $it.usage} }
    }
  }
  {
    name: vars_menu
    only_buffer_difference: false
    marker: "👀 "
    type: {
      layout: columnar
      columns: 1
      col_width: 20
      col_padding: 2
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      scope variables
      | where name == $buffer
      | each { |it| {value: $it.value }}
    }
  }
  {
    name: commands_with_description
    only_buffer_difference: true
    marker: "# "
    type: {
      layout: description
      columns: 4
      col_width: 20
      col_padding: 2
      selection_rows: 4
      description_rows: 10
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      scope commands
      | where name =~ $buffer
      | each { |it| {value: $it.name description: $it.usage} }
    }
  }
  {
    name: alias_menu
    only_buffer_difference: false
    marker: "👀 "
    type: {
      layout: columnar
      columns: 1
      col_width: 20
      col_padding: 2
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      scope aliases
      | where name == $buffer
      | each { |it| {value: $it.expansion }}
    }
  }
  {
    name: grid_history_menu
    only_buffer_difference: true
    marker: "<?> "
    type: {
      layout: description
      columns: 4
      col_width: 20
      col_padding: 2
      selection_rows: 4
      description_rows: 10
    }
    style: {
      text: green
      selected_text: green_reverse
      description_text: yellow
    }
    source: { |buffer, position|
      history
      | where command =~ $buffer
      | where exit_status < 1
      | get command
      | each  { |it| {value: $it description: (try {help $"($it | str trim)"| lines | get 0} catch { "" }) } }
    }
  }
  ]
  # endregion
  # region: Keybindings
   # mac keyboard
   # home = fn + left
   # end = fn + right
   # pageup = fn + up
   # pagedown = fn + down
   # backspace = delete
   # delete = fn + delete

  keybindings: [
  {
    name: insert_newline
    modifier: alt
    keycode: char_i
    mode: [emacs vi_normal vi_insert]
    event: { edit: insertnewline }
  }
  {
    name: insert_newline
    modifier: alt
    keycode: enter
    mode: [emacs vi_normal vi_insert]
    event: { edit: insertnewline }
  }
#   {
#     name: insert_newline
#     modifier: shift
#     keycode: (char cr)
#     mode: [emacs vi_normal vi_insert]
#     event: { edit: insertnewline }
#   }
  {
    name: trigger-completion-menu
    modifier: none
    keycode: tab
    mode: [emacs vi_normal vi_insert]
    event: {
      until: [
        { send: menu name: completion_menu }
        { send: menunext }
        { edit: complete }
      ]
    }
  }
  {
    name: completion_previous
    modifier: shift
    keycode: backtab
    mode: [emacs vi_normal vi_insert]
    event: { send: menuprevious }
  }
  {
    name: clear
    modifier: none
    keycode: esc
    mode: [emacs vi_normal vi_insert]
    event: { edit: clear }
  }
  {
    name: complete_hint_chunk
    modifier: alt
    keycode: right
    mode: [emacs vi_normal vi_insert]
    event: { until: [
      { send: historyhintwordcomplete }
      { edit: movewordright }
    ]
    }
  }
  {
    name: un_complete_hint_chunk
    modifier: alt
    keycode: left
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: backspaceword }
    ]
  }
  {
    name: trigger-history-menu
    modifier: control
    keycode: char_x
    mode: [emacs vi_normal vi_insert]
    event: {
      until: [
        { send: menu name: history_menu }
        { send: menupagenext }
      ]
    }
  }
  {
    name: trigger-history-previous
    modifier: control
    keycode: char_z
    mode: [emacs vi_normal vi_insert]
    event: { until: [
      { send: menupageprevious }
      { edit: undo }
      ]
    }
  }
  {
    name: trigger-help-menu
    modifier: control
    keycode: char_q
    mode: [emacs vi_normal vi_insert]
    event: {
      until: [
        { send: menu name: help_menu }
        { send: menunext }
      ]
    }
  }
  {
    name: prev_shell
    modifier: control
    keycode: char_p
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: clear }
      { edit: insertchar value: p }
      { send: enter }
    ]
  }
  {
    name: next_shell
    modifier: control
    keycode: char_n
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: clear }
      { edit: insertchar value: n }
      { send: enter }
    ]
  }
  # {
  #   name: change_dir_with_fzf
  #   modifier: control
  #   keycode: char_f
  #   mode: [emacs vi_normal vi_insert]
  #   event: {
  #     send: executehostcommand,
  #     cmd: "cd (ls | where type == dir | each { |it| $it.name} | str join (char nl) | fzf | decode utf-8 | str trim)"
  #   }
  # }
  {
    name: complete_in_cd
    modifier: none
    keycode: f2
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: clear }
      { edit: insertString value: "./" }
      { send: Menu name: completion_menu }
    ]
  }
  {
    name: reload_config
    modifier: none
    keycode: f5
    mode: [emacs vi_normal vi_insert]
    event: {
      send: executehostcommand,
      cmd: $"source '($nu.env-path)';source '($nu.config-path)'"
    }
  }
  {
    name: clear_backbuffer
    modifier: control
    keycode: char_l
    mode: [emacs vi_normal vi_insert]
    event: { send: ClearScrollback }
  }
  # {
  #     name: edit_buffer
  #     modifier: control
  #     keycode: char_i
  #     mode: [emacs vi_normal vi_insert]
  #     event: { send: OpenEditor }
  # }
  {
    name: insert_last_token
    modifier: alt
    keycode: char_.
    mode: [emacs vi_normal vi_insert]
    event: [
      { edit: InsertString, value: " !$" }
      { send: Enter }
    ]
  }
  # Keybindings used to trigger the user defined menus
  { #notworking
    name: fzf_history_menu_fzf_ui
    modifier: alt
    keycode: char_e
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: fzf_history_menu_fzf_ui }
  }
  {
    name: fzf_menu_nu_ui
    modifier: alt
    keycode: char_w
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: fzf_menu_nu_ui }
  }
  {
    name: commands_menu
    modifier: control
    keycode: char_t
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: commands_menu }
  }
  {
    name: vars_menu
    modifier: control
    keycode: char_y
    mode: [emacs, vi_normal, vi_insert]
    event:[
      { send: menu name: vars_menu }
      { edit: insertchar, value: ' '}
    ]
  }
  {
    name: commands_with_description
    modifier: control
    keycode: char_u
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: commands_with_description }
  }
  {
    name: alias_menu
    modifier: control
    keycode: char_a
    mode: [emacs, vi_normal, vi_insert]
    event: { send: menu name: alias_menu }
  }
#   {
#     name: fuzzy_history_skim
#     modifier: control
#     keycode: char_r
#     mode: [emacs vi_normal vi_insert]
#     event: {
#       send: executehostcommand
#       cmd: "commandline (history | each { |it| $it.command } | uniq | reverse | str join (char nl) | sk --layout=reverse --height=40% -q (commandline) | decode utf-8 | str trim)"
#     }
#   }
  {
    name: insert_last_arg_from_prev_cmd
    modifier: alt
    keycode: char_.
    mode: [emacs, vi_normal, vi_insert]
    event: {
        send: executeHostCommand
        cmd: "commandline --insert (history | last | get command | parse --regex '(?P<arg>[^ ]+)$' | get arg | first)"
    }
  }
  {
    name: fuzzy_history_fzf
    modifier: control
    keycode: char_r
    mode: [emacs , vi_normal, vi_insert]
    event: {
      send: executehostcommand
      cmd: "commandline (
        history
          | each { |it| $it.command }
          | uniq
          | reverse
          | str join (char -i 0)
          | fzf --read0 --tiebreak=chunk --layout=reverse  --multi --preview='echo {..}' --preview-window='bottom:3:wrap' --bind alt-up:preview-up,alt-down:preview-down --height=70% -q (commandline)
          | decode utf-8
          | str trim
      )"
    }
  }
#   {
#     name: fuzzy_history
#     modifier: control
#     keycode: char_r
#     mode: [emacs, vi_normal, vi_insert]
#     event: [
#       {
#         send: ExecuteHostCommand
#         cmd: "commandline (
#           history
#             | each { |it| $it.command }
#             | uniq
#             | reverse
#             | str join (char -i 0)
#             | fzf --read0 --layout=reverse --height=40% -q (commandline)
#             | decode utf-8
#             | str trim
#         )"
#       }
#     ]
#   }
  {
    name: insert_file
    modifier: alt
    keycode: char_y
    mode: [emacs vi_normal vi_insert]
    event: {
      send: executehostcommand
      cmd: "commandline --insert (fzf --tiebreak=chunk --layout=reverse  --multi --preview='echo {..}' --preview-window='bottom:3:wrap' --height=70% | decode utf-8 | str trim)"
    }
  }
  {
    name: insert_sudo
    modifier: alt
    keycode: char_s
    mode: [emacs, vi_insert, vi_normal]
    event: [
      { edit: MoveToStart }
      { send: ExecuteHostCommand,
        cmd: 'if (commandline | split row -r '\s+' | first) != `sudo` { commandline --insert `sudo `;commandline --cursor-end; }'
      }
    ]
  }
  ]
  # endregion
}
# endregion
# Custom Commands
source defs.nu

# region: prompts
# prompt
use "modules/prompt/oh-my.nu" git_prompt
$env.PROMPT_COMMAND = {|| (git_prompt).left_prompt }
$env.PROMPT_COMMAND_RIGHT = {|| (git_prompt).right_prompt }
$env.PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi green_bold)\n❯ (ansi reset)"} else {$"(ansi red_bold)\n❯ (ansi reset)"}}
$env.TRANSIENT_PROMPT_COMMAND = { "" }
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = { || (git_prompt).right_prompt }
$env.TRANSIENT_PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi light_yellow_bold)❯ (ansi reset)"} else {$"(ansi light_red_bold)❯ (ansi reset)"}}

# use "modules/prompt/full-line.nu"
# $env.PROMPT_COMMAND = {|| full-line }
# $env.PROMPT_COMMAND_RIGHT = ""
# $env.PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi green_bold)\n❯ (ansi reset)"} else {$"(ansi red_bold)\n❯ (ansi reset)"}}

# $env.STARSHIP_SHELL = "nu"
# $env.STARSHIP_SESSION_KEY = (random chars -l 16)

# $env.PROMPT_INDICATOR = ""
# $env.PROMPT_MULTILINE_INDICATOR = (^starship prompt --continuation)

# $env.PROMPT_COMMAND = { ||
#     let width = (term size | get columns)
#     ^starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
# }

# $env.PROMPT_COMMAND_RIGHT = { ||
#     let width = (term size | get columns)
#     ^starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
# }

# source "prompt/oh-my-v2.nu"
# $env.PROMPT_COMMAND = { (get_prompt 24bit).left_prompt }
# $env.PROMPT_COMMAND_RIGHT = { (get_prompt 24bit).right_prompt }

# experiment with panache-git
# source "prompt/panache-git.nu"
# $env.PROMPT_COMMAND = { panache-git }
# endregions

# external completions
use "custom-completions/cargo/cargo-completions.nu" *
# use "custom-completions/git/git-completions.nu" *
# use "custom-completions/winget/winget-completions.nu" *

# git completions and aliases
use custom-completions/git/git-completions.nu *
use aliases/git/git-aliases.nu *

# temperature converter
use "sourced/temp.nu" *

# get_weather
use "modules/weather/get-weather.nu" get_weather

# zoxide
source ~/.zoxide.nu

# if LS_COLORS exists, hide it
if 'LS_COLORS' in ($env | columns) {
  hide-env LS_COLORS
}

# make sure my PATH is unique
$env.PATH = ($env.PATH | each {|r| $r | split row (char esep)} | flatten | uniq | str join (char esep))
# source /Users/fdncred/.config/broot/launcher/nushell/br

# alias ls = eza -lhA --color=always --group-directories-first --color-scale-mode=gradient --grid --icons --git --git-repos --color-scale all --no-user --no-permissions

@fdncred Thanks! Tried your config and I still get that issue (Nushell 0.88), gonna give up on figuring that out :(

@fdncred In my config, it turns out I was sourcing Carapace, which spewed errors every time completions were triggered. When I stopped sourcing that, the jumping issue was fixed for me. Maybe you're also sourcing something like that?

the problem is that whenever you trigger a completion with this prompt config, we send it from the second line (so thats where i get the cursor pos). But when the cursor teleports to the line above, no menu-event is being sent, so if you dont press anything the menu will think the cursor is where the actual completion was triggered from (line 2). Thats whats causing the jumping

So id say the underlying problem is that this cursor teleportation is happening (without updating the menu)

I don't know if sending another event would be possible but moving the update_working_details call to right after the prompt is drawn might help get the right cursor position?

@ysthakur so i tried that but the problem is to refresh the cursor pos prior to rendering the full menu, the stdout needs to be flushed which leads to flickering in the terminal.
i think it would be better to update the cursor pos externally; so before getting the menu string; we could call something like menu.set_cursor_pos(...);
and this could be done in here

https://github.com/nushell/reedline/issues/706
I reviewed the code and my only issue is the one I posted above...
Which is not really related to this PR per se --- but something to keep in mind
In the future prior to adding more menu types we should think about how to solve the above issue first 😄
The nice thing about this PR is that all of new logic is located inside the ide_menu.rs so there is basically no risk of messing with any of the underlying reedline code...
I would say go ahead and land this PR once the other issues mentioned in the PR have been ironed out...

@fdncred i think i have fixed it
it works for me now using your config
$env.PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi green_bold)\n❯ (ansi reset)"} else {$"(ansi red_bold)\n❯ (ansi reset)"}}
$env.TRANSIENT_PROMPT_COMMAND = ""
$env.TRANSIENT_PROMPT_INDICATOR = {|| if ($env.LAST_EXIT_CODE == 0) {$"(ansi light_yellow_bold)❯ (ansi reset)"} else {$"(ansi light_red_bold)❯ (ansi reset)"}}

could you give it a try now?

@maxomatic458 I'm trying to build your nushell main and am getting this. Is there a different way I should try this?

@fdncred did you run cargo update?

@maxomatic458 ok i did cargo update -p reedline and it compiles now but doesn't run. I guess it's because the my gstat plugin maybe?
Please join our Discord community at https://discord.gg/NtAbbGn
Our GitHub repository is at https://github.com/nushell/nushell
Our Documentation is located at https://nushell.sh
Tweet us at @nu_shell
Learn how to remove this at: https://nushell.sh/book/configuration.html#remove-welcome-message

It's been this long since Nushell's first commit:
4yrs 8months 7days 22hrs 56mins 52secs 295ms 948µs 900ns

Startup Time: 1sec 251ms 217µs

 .cargo    │  assets  │  devdocs │  src   │  .gitattributes │  Cargo.toml         │  Cross.toml │  rust-toolchain.toml
 .githooks │  benches │  docker  │  tests │  .gitignore     │  CODE_OF_CONDUCT.md │  LICENSE    │  toolkit.nu
 .github   │  crates  │  scripts │  wix   │  Cargo.lock     │  CONTRIBUTING.md    │  README.md  │
toolkit module detected...
activating toolkit module with `use toolkit.nu`
Error:   × Plugin failed to decode
  help: invalid length 3, expected struct CallInfo with 4 elements

Error:   × Plugin failed to decode
  help: invalid length 3, expected struct CallInfo with 4 elements

Error:   × Plugin failed to decode
  help: invalid length 3, expected struct CallInfo with 4 elements

I'm going to try cargo clean/rebuild.

oh, this is because your main may be out of date. we had a plugin change in the last week or so.

oh ok, ill sync my fork

I think it's probably good enough to land but it's still weird that it doesn't start where my cursor is on the second line of my prompt. I just don't think that's something you've introduced, but has been there all along. So, I wouldn't expect you to fix that part in this PR.

@fdncred
yes, same thing happens using any menu (with your config)
i think that happens because your base indicator contains a \n,
but your completion indicator doesnt
i think you could fix that by just adding a \n to your completion indicator (because the default indicator just gets replaced with the menu indicator)
so i think its not a bug, but just a weird config

That's mostly it but something else is going on too but that's for another PR.

Thanks for all your hard work on this PR!

Is there a PR in nushell to use set_cursor_pos in nushell so we can build with this PR? If not can you create one? Apparently, your PR is another PR https://github.com/nushell/nushell/pull/11535#issuecomment-1902077334 because it isn't implemented.

ill make one right now

awe, thank you so much! we really appreciate it.

@fdncred just made one https://github.com/nushell/nushell/pull/11589

@maxomatic458 one last thing. I was trying to use this ide style menu and i'm getting errors in nushell. What am I getting wrong?
I added this to my menus in config.nu
  {
    name: completion_menu
    only_buffer_difference: false
    marker: $" \n❯ (char -u '1f4ce') "
    type: {
      layout: ide # the new ide style menu
      border: true
    }
    style: {
      text: { fg: "#33ff00" }
      selected_text: { fg: "#0c0c0c" bg: "#33ff00" attr: b}
      description_text: yellow
    }
  }

Maybe there are some other changed needed in nushell that I'm not seeing because I'm half asleep still. 😆

@fdncred yea there is no support currently for loading it from config.nu, its pretty easy to add (ive already done it in my fork, which i have deleted by accident)
i can make a PR for this later. But i think ill do this after https://github.com/nushell/reedline/pull/708 is merged (so multiline edits properly work)

ya, i was looking for your fork. LOL. i'm fine with waiting for 708. thanks!

Have you run into this? I can't seem to select a word+space, like " word" or "word " on my mac. I'm doing shift+ctrl+left and shift+ctrl+right in the gif. I could've swore i was able to do it on my windows machine.

on windows im able to do this here:
" word"
cursor at the start, then ctrl+shift+right
will select the whole string (including the space at the start)
same works with  "word ", when the cursor is behind the the last space
do you think this might be related to this PR?
but i dont really see whats wrong in your clip,
do you mean that you would require an extra press of ctrl+shift+right to select the space as well?

on mac, i was able to figure out that shift+left was doing the selection character by character. doing ctrl+shift+left is doing the selection word by word.
what i was expecting was that ctrl+shift+left would select character by character vs word by word. maybe that's my mistake.
I'm also wondering if terminal bindings come into play here with selection, like we saw with select_all previously with WT.


feature: Trouble in the Dasboard

Did you check the docs?

[X] I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.
It is not related to any  problem. It is just "nice to have" request
Describe the solution you'd like
I would like to display Trouble todo in the Dashboard
It would be nice if it would have features as follow:

detecting if neovim was opened in some project folder  (the default behavior)
configure which tags to display: e.g. TODO, NOTE, FIX, FIXME.. etc
configure default folding level for all tags and specific one (for example all tags by default folded, but FIXME unfolded until level 1)
configure order of tags: For example for me FIX and FIXME should go before TODO, NOTE

Describe alternatives you've considered
I was considering to write some functions to get todo items  using Trouble.get_items() , but that was just a plan.
Additional context
No response

+1


Add the ability to change the watch options on paths

From @cgat on December 9, 2014 0:59
I'm building a map that displays realtime path data to the user using polling. On each poll interval, I update the paths property with a new updated path object, which contains a latlng array that can amass up to 4000 coordinates.
With the way the paths directive has been implemented, there is a 'deep watch' (ie scope.watch("", fn, true) on both the paths scope variable, but also on each individual path object.
By changing the paths $watch to a $watchCollection and removing the 'deep watch' true parameter from the individual path watches, I achieved huge performance gains.
So my questions are:

Should this be the default behaviour? The downside is that this would be a breaking change.
If not default, how would you like the api for modifying the watch options for paths to be implemented?

I can make a pull request, but I thought I would get your input before moving ahead.
Copied from original issue: tombatossals/angular-leaflet-directive#559

From @cgat on December 10, 2014 1:44
I've dug into this a bit more and found that the same is true for markers. In addMarkerWatch, I remove the true option and in the marker directive I change watch to watchCollection. I realize this is a fundamental change in the way the leaflet-directive operates, and also removes some of the current functionality, but the performance improvement are huge, at least in my scenario.
To clarify my use case:
-potentially 1000s of markers
-Realtime(ish). Markers are expected to update often, updates are polled every second. Marker and paths are replaced on every poll (this is why my solution works above).
I've forked and pushed to a branch called no-deep-watch. Feel free to have a try yourself: https://github.com/cgat/angular-leaflet-directive/tree/no-deep-watch
What are your thoughts on integrating this type of behaviour in the directive? I'd be willing to put in some time to get it going, but I'm not 100 percent sure what would the best approach be without breaking a lot of things. Perhaps an option to use an observePattern type service to notify the directive of changes?

From @tombatossals on January 25, 2015 19:13
I'm doing this in my spare time, but I'm searching for some time and rework all the code. All the experience of these years could make this directive evolve.
It would be great if you could help, you know the code, you have good ideas, and you're great programming angular.
I have almost finished coding the angular-openlayers-directive, so maybe in a few weeks I could start refactoring this library. If you want to get involved just tell me and we could open a trello board for this new version.

From @cgat on January 12, 2015 3:48
Thanks for the response @tombatossals. Were these changes supposed to be made in the commit you made for issue #590? It looks like only paths were changed to used "$watchCollections".
I should point out that if you do use this solution for marker watchers as well, it will introduce breaking changes. At the moment, if you hold a reference to a marker that is watched, you can change the internal state of the marker and the map marker will get updated (a good example of this is change the 'focus' property to true). If we change to "$watchCollection", you'd have to replace the marker with an updated version of the object to get it to work. Personally, I think this is the better solution given the performance improvements, however, I could see this upsetting people.
I was thinking that it might be nice to have one watcherOptions directive, which allows the users to configure how each element type is watched. For example, the input to the directive could be something like:
{
  markers: "collection", //--> use $watchCollections
  paths: true, //--> use $watch(...., true),

  .... any other map element
}

This would be opposed to having a watch directive for each element type (watch-markers, watch-paths, etc).
Thoughts?

From @cgat on January 20, 2015 23:9
Yes! I think that would be a great solution. This will give lots of control over performance to the developer using angular-leaflet and make your code base easier to reason with. How far off do you think this reason would be? If I can help out (update examples, etc), let me know.

From @tombatossals on January 18, 2015 10:29
Hi @cgat, thanks for your ideas. I finally didn't change to "watchCollection" on markers, but changhed the "geojson" object to it. I have to take a look closely on changing the markers because what you say, it could break old code.
I'm thinking about reworking this directive when leaflet-0.8 goes out and solve some of the functionality that could be improved, for example listen to only the markers you are interested, not everyone.
I would like to research the possibility to take out the marker as a dom tag, so it could be customized easily, and not to have big objects linked to the main "leaflet" tag. I have coded something similar in the "angular-openlayers-directive" and it works pretty well. Take a the code of this example:
http://tombatossals.github.io/angular-openlayers-directive/#/markers/marker-no-javascript
What do you think about it?

From @tombatossals on January 8, 2015 16:0
Hi @cgat, sorry I didn't read your issue before. You're totatlly right "$watchCollections" is the way to go.
I'm going to apply the same solution to the markers watchers.
Thanks so much!

From @cgat on January 27, 2015 16:50
I realize you do this on your spare time, so forgive me if I came across a bit too eager in my previous message.
I'm definitely interested in helping out. Contact me in a few weeks and we'll get the ball rolling.