Bug 456622 - Kdevelop misinterprets typescript files
Summary: Kdevelop misinterprets typescript files
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 5.8.220402
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-12 14:00 UTC by amixra
Modified: 2022-07-30 07:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of trying to open typescript file (7.23 KB, image/png)
2022-07-12 14:00 UTC, amixra
Details
Screenshot of the bottom part of KDevelop (23.29 KB, image/png)
2022-07-13 10:25 UTC, Igor Kushnir
Details
Kdevelop bottom (4.58 KB, image/png)
2022-07-14 06:29 UTC, amixra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description amixra 2022-07-12 14:00:32 UTC
Created attachment 150555 [details]
screenshot of trying to open typescript file

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Opening a typescript file kind of hangs kdevelop because it seems to interpret it as some mpeg/video kind of media which should be "played". Looking at the tool systems and different options I got the feeling that it is mainly focused on C/C++ type of source codes. But it was sitting in my machine from a long time so I just wanted to use it. And I think it shouldn't behave so strange literally, at least a text editor kind of interface (with maybe some syntax highlighting) shouldn't be difficult for this kind of application.

STEPS TO REPRODUCE
1. Open any typescript (.ts) file type.


OBSERVED RESULT
It tries to play it (and when tried open with option from right-click context menu, it suggests all those playing kind of applications).

EXPECTED RESULT
A simple text editor interface. 


Or maybe play the typescript file (if kdevelop really wants to play it) I tried as much as possible to play it but that also doesn't seem to happen. 😅

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.25.1 
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
Comment 1 Igor Kushnir 2022-07-12 18:39:00 UTC
Cannot reproduce. How does Kate or KWrite open these files? In the bottom left corner of KDevelop, Kate and KWrite there is a mode selection button. What mode is selected for your typescript files by default? Does it work correctly when you set TypeScript mode manually?
Comment 2 amixra 2022-07-13 05:12:49 UTC
(In reply to Igor Kushnir from comment #1)
> How does Kate or KWrite open these files?
They open it as they should as a text editor. Completely normal and expected behaviour.

> In the bottom
> left corner of KDevelop, Kate and KWrite there is a mode selection button.
I do have mode selection in Kate and KWrite in the bottom right corner but there is nothing like that in kdevelop. [Screenshot](https://pasteboard.co/08da8U1w5rOn.png)

To confirm whether we both are talking about the same thing, the following screenshot is from kate which works as expected.
[Kate](https://pasteboard.co/r7ZoOFm14L7N.png)
Comment 3 Heinz Wiesinger 2022-07-13 06:55:33 UTC
I think the mime type detection causes this. *.ts is a valid extension for video/mp2t, MPEG-2 Transport Stream, which is why kdevelop would load a kpart to try to play a video.
Comment 4 Igor Kushnir 2022-07-13 10:25:25 UTC
Created attachment 150582 [details]
Screenshot of the bottom part of KDevelop
Comment 5 Igor Kushnir 2022-07-13 10:28:46 UTC
(In reply to amixra from comment #2)
> I do have mode selection in Kate and KWrite in the bottom right corner but
> there is nothing like that in kdevelop.
> [Screenshot](https://pasteboard.co/08da8U1w5rOn.png)
Attached a screenshot where this bottom bar is present in KDevelop

As you haven't been using KDevelop for a long time, maybe some old config files break the UI and file mode detection on your side? Assuming you don't have any valuable configuration there (if you do, create a backup), try removing ~/.config/kdeveloprc, ~/.local/share/kdevelop.
Comment 6 Milian Wolff 2022-07-13 14:46:13 UTC
What does `kmimetypefinder5 foobar.ts` say for you? I indeed get `video/mpeg` back. You probably need to solve that via `File Associations` in `system-settings`, there you can screate a new text/x-typescript mimetype, that should hopefully fix it then. Or remove the .ts pattern from the other mime types.

Generally though this is not something we can handle within kdevelop easily.
Comment 7 amixra 2022-07-14 06:29:14 UTC
Created attachment 150607 [details]
Kdevelop bottom

After deleting both files, UI did change a bit. Updated and again deleted both files but the bottom part doesn't have any bar like that as in your screenshot.
Comment 8 amixra 2022-07-14 06:35:26 UTC
(In reply to Milian Wolff from comment #6)
> What does `kmimetypefinder5 foobar.ts` say for you? I indeed get
> `video/mpeg` back.
Same here.
> You probably need to solve that via `File Associations`
> in `system-settings`, there you can screate a new text/x-typescript
> mimetype, that should hopefully fix it then. Or remove the .ts pattern from
> the other mime types.
This allows opening *.ts files now after one [popup] (https://pasteboard.co/CH9RSk49CVNj.png)
 
> Generally though this is not something we can handle within kdevelop easily.
I wonder why I never faced this with other editors if *.ts was always there as video/mpeg type.
Comment 9 amixra 2022-07-14 06:49:27 UTC
(In reply to amixra from comment #8)

> This allows opening *.ts files now after one [popup]
Oh that was because I had added it into application group following the convention of javascript. There isn't any popup after adding into text group.
Comment 10 Igor Kushnir 2022-07-14 08:06:15 UTC
(In reply to amixra from comment #7)
> Created attachment 150607 [details]
> Kdevelop bottom
> 
> After deleting both files, UI did change a bit. Updated and again deleted
> both files but the bottom part doesn't have any bar like that as in your
> screenshot.
Ah, right. The mode selection button is part of the text editor view. So it only appears when a file is opened in KDevelop's text editor.

By the way, "Cannot reproduce" in my earlier comment means that I tried opening several *.ts files and they were correctly recognized and opened as TypeScript by KDevelop on my system (Manjaro Xfce).
Comment 11 Bug Janitor Service 2022-07-29 04:35:51 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!