2417 Commits
Author SHA1 Message Date
Konstantin Nisht 439bcb33ad [threading] RUBY-34098: Terminate processes on EDT
For an unknown reason, process termination requires write-intent read action. Previously the write-intent lock was acquired on a background thread, which interfered with active modal progresses. Now we dispatch process termination to EDT. We hope that process termination does not require write action


(cherry picked from commit be5b8bc9e69b97b957ee9a1fd3ef8fa8e85d0ddf)

IJ-CR-165004

GitOrigin-RevId: b3182bb3682141e81775306130f540af449dd5e3
2025-06-06 11:25:38 +00:00
Konstantin Hudyakov 46b6d84c70 [terminal] IJPL-188640 Fix using editor font preferences in the terminal execution console
(cherry picked from commit 06714d88795ae5480cf662dfe8422204b6005c3c)

IJ-CR-163959

GitOrigin-RevId: 3a1f450a834373344a528ea0e090fc345204809e
2025-05-26 23:32:51 +00:00
Sergei Tachenov 3a9f70eaa0 IJPL-187617 [terminal] Don't show the zoom indicator if the font size is reset
The font size can be reset for many reasons, and it's not easy
to track them all from a listener. But if it's reset, we almost
never need a zoom indicator. On the other hand, if it's explicitly
set to any value, the zoom indicator is almost always useful.
So it seems like a good approximation to determine
whether we need it or not.

Pass a boolean flag to listeners so they can decide whether
a zoom indicator is needed. We don't have this zoom
in execution-impl, so there it doesn't matter what we pass.

(cherry picked from commit eebc12f64d0aed8f5d8a39e1606193c5b704ad5b)

IJ-CR-162754

GitOrigin-RevId: 1a5ac1d6a7c88ad4626f27713f9e3934b97ed48f
2025-05-23 08:25:45 +00:00
Konstantin Hudyakov 61cdef5ec9 [terminal] IJPL-163552 Use the shell integration to update the current directory
But if there is no shell integration, the heuristic-based approach will be used.

(cherry picked from commit c8c1a3b33f0f83eb1c7dc6a61c78197b1a0fe780)

IJ-CR-162752

GitOrigin-RevId: 4bfdce78fef241baf7b07308472db1396c158807
2025-05-23 08:25:45 +00:00
Konstantin Hudyakov 27afb05d53 [terminal] IJPL-163552 Add the current directory field to the terminal session model
For now, it is only the initial value. Updating will be implemented in the next changes.

(cherry picked from commit c8383bb0bc1b94876b295376ebce6e5da77cf624)

IJ-CR-162752

GitOrigin-RevId: 98ae779c270d05997c8245d10abb3d492efdd197
2025-05-23 08:25:44 +00:00
Konstantin Hudyakov 904a983147 [terminal] IJPL-183805 Report typing and output latency in batches
Use averaging functions to report only a couple of values for a batch of samples.
Use a batch size of 50 for typing events and 100 for output events. Output events can occur more often.
So, there will be fewer events reported.

(cherry picked from commit cc6f880e1bc56974656d3e70d7f03da98510568c)

IJ-CR-160384

GitOrigin-RevId: 5dc635d88023c0182af91128077d3882d2003db0
2025-05-23 08:25:44 +00:00
Konstantin Hudyakov f10af1490a [terminal] IJPL-182482 Refactor: add id field to all terminal input events
It is just more suitable to have id in all events, not particular ones.

(cherry picked from commit d53c7ce7e6558dd4070b63b763af738dc487d205)

IJ-CR-160384

GitOrigin-RevId: 85b3042a7cecfa30a91eb865bbb508eb769ede13
2025-05-23 08:25:44 +00:00
Konstantin Hudyakov 474217c2f3 [terminal] IJPL-182482 Ignore read time during serialization
We need this `readTime` only locally on the backend and put it to the event object only for simplicity.
It is not a good design, but for now there is no suitable alternative. Ideally, we need to have the separate serializable DTO classes hierarchy for RPC.
Or switch to plain longs for measuring the time.

(cherry picked from commit f8e20acdfe0d856c73750711d1a14917fc9b5973)

IJ-CR-160384

GitOrigin-RevId: e12a5a402f4065595b9ed2f25c79bdfb7f5a6734
2025-05-23 08:25:44 +00:00
Konstantin Hudyakov 573bf6b9e3 [terminal] IJPL-182482 Reimplement the backend output latency measurement
This implementation is more simple:
1. We track the last time of reading from the TTY.
2. We remember the time from step 1 when we text buffer is changed the first time. Here output accumulation session starts.
3. Once output is collected, we put the time from step 2 to the created `TerminalOutputUpdatedEvent` and reset it. Here output accumulation session ends.
4. Once we update the backend models with this event, we report the backend output latency and forward the event to the frontend.

(cherry picked from commit ed4e4920b46e5bdd7feb27fa7200e4858b629632)

IJ-CR-160384

GitOrigin-RevId: e69dbf55349236fa8a4940228631c0f358c6fd60
2025-05-23 08:25:44 +00:00
Sergei Tachenov e72baf2a8a [terminal] IJPL-182482 Implement terminal frontend output latency FUS
The hardest part here is to understand when the received data
is actually displayed. The problem is that it may not be displayed
at all, for example, if the editor is hidden or scrolled away.

Using the hooks added to the editor, we can make an assumption:
if the editor is showing, and there was a repaint request,
then it's very likely to be repainted soon. In that case we wait
for the repaint before reporting the latency.

If there's no repaint request, then we report the latency immediately,
adding a boolean flag to the event to distinguish between the cases.

Because events are received and applied as whole,
there are no separate events for the first and last characters.
Instead, we report both character indices in one event.
So for two backend events we have one frontend event.

(cherry picked from commit df72687dc3ef31bece6eeaf7cd624dc18c462d6e)

IJ-CR-160384

GitOrigin-RevId: ae6f6527f332cd31f20735238a9748249aa27bc5
2025-05-23 08:25:43 +00:00
Sergei Tachenov 790d8e1b36 [terminal] IJPL-182482 Implement terminal backend typing latency
This process is not single-threaded, but it involves only
one thread transfer: from the receiving coroutine
to the terminal thread, which uses an executor
that is never shut down, so it's pretty much a guarantee
that for every byte array there will be at least an attempt
to write it. Using this fact, we can store a byte array to activity
map and remove activities when the byte arrays are written.
Using a try-finally block there ensures that the activity is eventually
finished.

The activity ID is transferred along with the event,
to ensure that the same ID is used on the frontend and on the backend.

(cherry picked from commit 66587a5cca59053dab1e4bf2bee9bd098fe10637)

IJ-CR-160384

GitOrigin-RevId: c1b9cdb9f30723f0d98fd211c94494e59b2d7eb4
2025-05-23 08:25:43 +00:00
Sergei Tachenov 7f73acf4f1 IJPL-184069 Use the terminal font size wrapper for range checks
To ensure that the current size is always valid,
make both parse() and ofFloat() coerce the value
into the valid range and then use the wrapper class
for TerminalFontSizeProviderImpl internal state.

(cherry picked from commit 31d0916587d84f83c4375dc6868ffc63cb16c136)

IJ-CR-160631

GitOrigin-RevId: 6c9c86ee434311676719adf6309f42343088b6a4
2025-05-23 08:25:43 +00:00
Sergei Tachenov 8b8fa968c8 IJ-CR-160631 Make TerminalChangeFontHandler implementations private
(cherry picked from commit b1d7301429f6338cd0b6921787fcefb0ef4e580a)

IJ-CR-160631

GitOrigin-RevId: ac9bb4a00ce6f2dab7452261d3fd0920ab7bcac1
2025-05-23 08:25:43 +00:00
Sergei Tachenov cd0b306020 IJPL-184075 Fix increase/decrease font size action for the reworked terminal
Disable the editor's actions to avoid conflicts. For this,
add a boolean property to the strategy API.

Implement a new editor size handler for the reworked
terminal. For that, provide the font size service
as a data key in the editor, so the actions
located in execution-impl can access the service
internal to the terminal otherwise.

While we're at it, introduce action text overrides for
Search Everywhere to avoid confusion between editor's
and terminal's actions.

Note that the reset font size actions are available
from both the terminal and the editor. This is,
unfortunately, necessary at this point because
that's how that "Reset to XXpt" link works at the moment.
This can be fixed in the future if necessary.

(cherry picked from commit 7c96b64ed1b7d7330a2c64198fb49a45820c2912)

IJ-CR-160631

GitOrigin-RevId: 8c83193d51d71bbe65bdcd939ddedea8a5599901
2025-05-23 08:25:43 +00:00
Sergei Tachenov c167d34d44 IJPL-184075 Refactor TerminalChangeFontSizeAction and reset action
Extract an abstract handler interface that we can reuse
for the reworked terminal.

(cherry picked from commit 00a3007fb4104bfb590edf373491b34869aea191)

IJ-CR-160631

GitOrigin-RevId: 3b4567a0ac88ae7ad20d2fbb3d36a8c8655ff79d
2025-05-23 08:25:43 +00:00
Sergei Tachenov 410ba1c19b IJPL-184068 Use Float for terminal font sizes
Rounding to Int was implemented before Float font sizes
became a thing. Now it seems more reasonable to just use Float
everywhere than have a mess of Float and Int with roundings
and conversions.

Drop those 2D suffixes and port everything to Float.

(cherry picked from commit daeb3ae0625dfe029bf92c6a91ea1a43d631aeeb)

IJ-CR-160631

GitOrigin-RevId: 459995b093f506bb803c21a38802c9f94946306b
2025-05-23 08:25:43 +00:00
Sergey Simonchik 15fd0059c5 [terminal] deprecate JBTerminalWidget#getFontSize, getFontSize2D, setFontSize, resetFontSize
(cherry picked from commit aa157084dcd493dd08149b682fb1c45dcba1e663)

IJ-CR-160631

GitOrigin-RevId: 4a45e4b3b03b9cc0c86343c561156ccdb9e0ea33
2025-05-23 08:25:43 +00:00
Sergei Tachenov f97a3ad129 IJPL-181026 Replace Int with Long in terminal models
Whenever the absolute index is used, Int is risking overflowing.
Replace with Long.

Note that StyleRange is also used by the gen1 terminal,
but there its offsets are relative, not absolute.
So for gen1 code, just cast everything to Int as necessary.

(cherry picked from commit 3afff862356f603c5aa50d5023c51c623320103f)

IJ-CR-157580

GitOrigin-RevId: 4cedfa1ec263a21615852ffbf44ded2db547e8c6
2025-05-23 08:25:43 +00:00
Sergei Tachenov affe3445a3 IJPL-180885 Fix terminal cursor update for a trimmed line
If the cursor is on the first line, and it was partially trimmed
(e.g. a very long line being output), then its column index
is not equal to the column index in the document anymore.
This causes a lot of extra spaces to be added to the end
of the line to display the cursor somewhere far beyond
the end.

Fix by keeping track of the characters trimmed from the first
line and by adjusting the cursor position accordingly.
Make sure this new counter is persisted as a part of the state.

Add a test to check both the fix and state dump/restore.

(cherry picked from commit 051518e8f3ae8a8726c627a9c2de55a08c109b53)

IJ-CR-157580

GitOrigin-RevId: de81226bd0ea8f87af0bbccb1663ab70d28fe2c3
2025-05-23 08:25:43 +00:00
Sergey Vardanyan dfabfeb1df Fix RIDER-125693: Replace listeners list in addEnvFilePathsChangeListener with the correct one
Merge-request: IJ-MR-162733
Merged-by: Sergey Vardanyan <sergey.vardanyan@jetbrains.com>

(cherry picked from commit 0dd0c3cf3174670cad8ff1cef2c02a933f037dfc)

IJ-CR-162941

GitOrigin-RevId: 6d7a1878cfddf687126566678d91aef8a2c4a49a
2025-05-20 22:23:53 +00:00
Andrii Zinchenko de00565b40 [eel] EelTargetEnvironmentRequest: fix local ports bindings
- IJ-CR-162138

GitOrigin-RevId: ca1492e03c906e6f9feeb813642abe21c3230b96
2025-05-14 15:17:44 +00:00
Konstantin Hudyakov 12caf41b5a [terminal] IJPL-183099 Fix using console font family in the classic terminal instead of terminal font family
(cherry picked from commit 5420284b0da98f76897ab91bc21ecc145fcc3bf2)

IJ-CR-158761

GitOrigin-RevId: 615a814e4d1f2a089c78659b92f2a7c7e019b798
2025-04-16 07:58:44 +00:00
Konstantin Hudyakov 3a5a26ec37 [terminal] IJPL-180991 Refactor: extract font size information to the separate interface
So we are able to substitute different implementations.

(cherry picked from commit 5c475255d09f535355c68da9252b683668d16d61)

IJ-CR-158761

GitOrigin-RevId: a543a6cab00004712744b0592ceb9ea92072f0c6
2025-04-16 07:58:44 +00:00
Konstantin Hudyakov 4b825a15b5 [terminal] IJPL-180991 Refactor: provide disposable with listener instead of listener implements Disposable
(cherry picked from commit 1e56397e3a27211d4a2826af2ec1364aac8d36e8)

IJ-CR-158761

GitOrigin-RevId: ebe4a085f72d20d56f4c6af50530bada63211ae2
2025-04-16 07:58:44 +00:00
Sergei Tachenov 1755fb052c IJPL-180991 Implement alternative font size state for the terminal
This allows us to have a separate default that comes
from the terminal-specific font settings.

(cherry picked from commit d33695d218b7c3fd306789d8a3f54a5ae6f34c68)

IJ-CR-158761

GitOrigin-RevId: 6acdab529f4acb3775ebd4c038795daa522cac25
2025-04-16 07:58:44 +00:00
Sergei Tachenov e80302cb47 IJPL-180991 Reduce dependency on TerminalUiSettingsManager
Now everything is done through JBTerminalSystemSettingsProviderBase,
so we can override the behavior for the terminal.

(cherry picked from commit a157494d190082e9a62b6130eb11b4cc3d16086c)

IJ-CR-158761

GitOrigin-RevId: 2724e086e4d7f98264d65a6c09ac31674dfe0ec6
2025-04-16 07:58:44 +00:00
Sergei Tachenov ebf9b6e4c8 IJPL-180991 Extract TerminalUiSettingsListener
To reduce coupling between the settings and the panel.
It'll be needed to implement an alternative settings state
for the terminal, that will respect the new font settings.

(cherry picked from commit a33f1e8528cda117732b78d66c55b7cf7f29616b)

IJ-CR-158761

GitOrigin-RevId: a4cc84eb461a8e0bf932503455d5a264ee4ce707
2025-04-16 07:58:44 +00:00
Konstantin Hudyakov f8d77d1d36 [terminal] Provide default implementation for isCommandRunning method
So it won't brake the overrides.


(cherry picked from commit 17b4deb9a684996bb2bd2dc01f5121a9731f5d4b)

IJ-CR-160254

GitOrigin-RevId: 82d0c6efdc86c25ea6ee3d9abb79e290dbee8721
2025-04-14 11:27:45 +00:00
Sergei Tachenov d71eb9c9d6 IJPL-177414 Terminal font settings - first attempt
To keep the JBTerminalSystemSettingsProviderBase interface,
add getColumnSpacing() to it, but keep the rest as-is,
even though we don't really need getTerminalFont(),
but need getTerminalFontName() instead.

Then, in JBTerminalSystemSettingsProvider override everything
relevant so that the actual values from the settings are used
instead.

(cherry picked from commit cb91fa1f26db16cc977e0aeccdb4cdcd472ebf28)

IJ-CR-156671

GitOrigin-RevId: 33da91fe163c56c4d8403e8c16fface83c0784fd
2025-04-10 09:42:44 +00:00
Sergey Simonchik c40f91f501 [terminal] IJPL-180734 get rid of caching myConsoleFilterProvidersAdded; it doesn't work with non-blocking read action
(cherry picked from commit 3ca207e6ebf5e04e689a9689ab1a30de732bf5e5)

IJ-CR-155762

GitOrigin-RevId: 7e2dee35901dc158954388e1feaeaa14fb90e206
2025-04-08 15:32:47 +00:00
Sergey Simonchik d36ed4173b [terminal] IJ-CR-155762 migrate to Channel to not buffer replay elements
`Channel` as a hot data source is more tailored to this producer-consumer task. Also, `Channel` is simpler than `MutableSharedFlow`.

The problem of buffering `replay` elements could also be fixed with `MutableSharedFlow` and `launch(start = CoroutineStart.UNDISPATCHED)`, but it feels more like a workaround and makes reasoning about code correctness more difficult.


(cherry picked from commit 023a772e351bbc11096d99bd4c2a63a4d0de6b15)

IJ-CR-155762

GitOrigin-RevId: 95e9459e3f82d2b267aa8dd3e246fc565e7894f8
2025-04-08 15:32:47 +00:00
Sergey Simonchik fb6f2b6d49 [terminal] IJ-CR-155762 ensure initial lines are not lost; clarify limitedParallelism(1)
(cherry picked from commit b89e5c4bb218ce05a68c72e54b2b3e1658f0a7ae)

IJ-CR-155762

GitOrigin-RevId: b87c0f0180049d1be335f4ef4e6a6c97d5083a3c
2025-04-08 15:32:47 +00:00
Konstantin Hudyakov bda56834aa [terminal] IJPL-180502 Fix showing confirmation on executing exit in the terminal
Executing of `exit` command is purely intentional action, we should not ask an additional confirmation in this case.


(cherry picked from commit 8de4bab3d3811feb6d4391782d97c5d62bd6949d)

IJ-CR-157168

GitOrigin-RevId: eab7d429b5adc4e6006a6683424f4499ce8d277b
2025-03-27 19:43:56 +00:00
Konstantin Hudyakov 663bc05eea [terminal] IJPL-180502 Refactor: add isCommandRunning method to the TerminalWidget
(cherry picked from commit 1dd016c305fd10cdb1c2f23cd91997380d5459ca)

IJ-CR-157168

GitOrigin-RevId: 535394ae5d9e45249d876afcdd32c0aef27f77ef
2025-03-27 19:43:56 +00:00
Sergey Vardanyan dfa18de130 Fix RIDER-123934: Fix LogConfigurationPanel entry selection
Merge-request: IJ-MR-158170
Merged-by: Sergey Vardanyan <sergey.vardanyan@jetbrains.com>

(cherry picked from commit da891a22f5340b33025b87f17336d3fcf49865ee)

IJ-CR-158367

GitOrigin-RevId: 111bd09d8b39f99b6227d8a645a425ad31853b3c
2025-03-27 11:03:29 +00:00
Konstantin Hudyakov 3caa0f2ae0 [terminal] IJPL-176708 Refactor: store shell integration enabled state in the TerminalState class
This value should be stored somewhere, so there are different places:
1. TerminalBlocksModel - looks too specific, our shell integration features can be not about blocks specifically.
2. TerminalSessionModel - the common place for different states and their values. Let's use this place.


(cherry picked from commit a9cfe0166a68e96a4e2f1860dcda7a1078befe6d)

IJ-CR-157017

GitOrigin-RevId: 50e17f1513df103ba43a8bb3a5d35653a13ab9ba
2025-03-27 09:48:29 +00:00
Konstantin Hudyakov ac25e07212 [terminal] IJPL-179295 Add comments to the TerminalSession
Clarify the choice of the `SendChannel` to send the input events.


(cherry picked from commit 33c03d236fa6317a844da28a4cf264f50461ca00)

IJ-CR-156212

GitOrigin-RevId: 6bc9d427b7805ed9ffac88074ad434f15417fdbb
2025-03-26 20:41:06 +00:00
Konstantin Hudyakov eb40cd937f [terminal] IJPL-179295 Ensure that input events are handled in the same order on backend as they are sent from frontend
Use `SendChannel` for this purpose.
Just calling `sendInputEvent` method in the right order does not guarantee the same order on backend.
To guarantee it, we have to wait until `sendInputEvent` method completes (the event is handled on backend) and only then send the new one.
But it is not acceptable in case of typing in RD: the latency would be very noticeable.
We should not wait for handling of the previous event before sending the next one, we should send it immediately.
And hopefully, `SendChannel` acts exactly like that, and also it provides the order guarantees.


(cherry picked from commit f3180a974c6bf8af6d12bd0ffe162d99ed95a31c)

IJ-CR-156212

GitOrigin-RevId: 47aaf8f20d202ec4ad69d8f9c16ccff4e18997ce
2025-03-26 20:41:06 +00:00
Vladimir Lagunov 053629a620 Eel: prepare for NoSuchFileException from isSameFile in EelTargetEnvironmentRequest
(cherry picked from commit 2e9a0e388798f8497514abb6a5a97d5e782467fe)

IJ-CR-155885

GitOrigin-RevId: 8e83850c1e2247fe5ab0a53e54215cf65d1c06d6
2025-03-05 23:35:44 +00:00
Vladimir Lagunov 23b41fe760 IJPL-178337 Eel, WSL: Bind EelPath.asNioPath to project for choosing between wsl$ and wsl.localhost properly
(cherry picked from commit afe74bc9570c42b7ac857391836c560acf071ac5)

IJ-CR-155885

GitOrigin-RevId: b7d091ed9be3e4fb9638806fc7315682998c8841
2025-03-05 23:35:44 +00:00
Alexander Glukhov 7727e2e5c7 [eel][wsl] fix gradle execution for a project located on wsl$
(cherry picked from commit 5e307e6941144ebeec4dc2f5701df674ff1cb565)

IJ-CR-155885

GitOrigin-RevId: 811528ad96e48b45a06b4e45972857d168c01e4c
2025-03-05 23:35:44 +00:00
Gregory.Shrago 92075dfa87 add knownIssue section for top issues
(cherry picked from commit 5d76777545145d3272aa20aebddaefe006cc84e8)

IJ-CR-156511

GitOrigin-RevId: 32c2231b0b3921b2a1cd5767b101c91f9470b011
2025-03-03 02:00:18 +00:00
Konstantin Nisht b6d3690b12 [threading] IJPL-149765: Rename writeAction to edtWriteAction #6
GitOrigin-RevId: 635c50933068a86ac0bf62608185bd359c7ac98c
2025-02-19 22:13:13 +00:00
Vladimir Krivosheev 0d5e0bc2e4 update bazel files
GitOrigin-RevId: 081d530ac0d542302aac0f5ede6b5b1c069cb87b
2025-02-19 12:16:58 +00:00
Vladimir Krivosheev 4afb630348 fix PyUnknownProjectSynchronizer visibility
GitOrigin-RevId: 7a67900bccc03df6968ff0b19b0d811f28b5c989
2025-02-19 08:33:01 +00:00
Konstantin Hudyakov 1624092e69 [terminal] IJPL-157242 Add initial state terminal output event
It will be used to pass the initial models state from backend to frontend on connection.

GitOrigin-RevId: a585d4377ff870ef733135bbf155ad0909d6e33b
2025-02-19 03:09:10 +00:00
Konstantin Hudyakov 3f530f843a [terminal] IJPL-157242 Make possible to dump and restore the state of TerminalBlocksModel
GitOrigin-RevId: f8bd3849b9ba610f629c51724dd9c7e8ea13d2a3
2025-02-19 03:09:10 +00:00
Konstantin Hudyakov a6d041b18c [terminal] IJPL-157242 Refactor: extract TerminalOutputBlock to the platform part
We will need to use it in the RPC, so it should be here together with other models we pass through RPC.

GitOrigin-RevId: e973d8375f30765c856b7583f67006091170ac46
2025-02-19 03:09:10 +00:00
Konstantin Hudyakov 29fdc499b0 [terminal] IJPL-157242 Make possible to dump and restore the state of TerminalOutputModel
GitOrigin-RevId: cd3cab50158f5cc9371932b5f5550bf986f1e855
2025-02-19 03:09:10 +00:00
Konstantin Hudyakov ecd7a97b6b [terminal] IJPL-157242 Adjust terminal session termination logic taking into account RD
`TerminalSession` now has its own lifecycle: it is considered as closed once we receive `TerminalSessionTerminatedEvent`.
`TerminalWidget` is not directly bound to the lifecycle of the session.
Their lifecycles are only connected through the logic in `TerminalToolWindowManager`.

There are several cases considered in this change:
1. Explicitly close the terminal tab: we send `TerminalCloseEvent` to close the session on the backend.
2. User executed `exit` command or pressed Ctrl+D: we terminate session, send `TerminalSessionTerminatedEvent` to frontend and close the terminal tab there.
3.  Frontend project is closed, leaving terminal tabs opened: we do not close terminal sessions on backend to make it possible to reconnect. But if the backend is terminated, the sessions will be closed with it.

GitOrigin-RevId: 1ecaba10d2a7cff3b391bee3484cd53808473866
2025-02-19 03:09:09 +00:00