Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline input #2741

Merged
merged 55 commits into from
Nov 10, 2022
Merged

Inline input #2741

merged 55 commits into from
Nov 10, 2022

Conversation

jojo2357
Copy link
Contributor

@jojo2357 jojo2357 commented Nov 3, 2022

Fixes #2740

Summary of additions and changes

  • Add the ability to inline \include calls and remove the definition file.

TODO

  • Create Dialog
  • Allow single inline
    Allow Scope selection

How to test this pull request

Create two files, one containing an include of the other.

\documentclass[12pt]{report}
\begin{document}
\include{other}
\end{document}

other.tex

\begin{equation}
math
\end{equation}

slideclimb and others added 5 commits October 31, 2022 21:23
Now it will scan ahead to the next terminating command instead of only looking one ahead. This had the issue of *any* command being able to get in the way and force the rest of the file to be gobbled up, now it should work as intended on Hannah-Sten#2724
Now it will only consider commands that appear *after* the current command. It will now only consider commands ahead of the one passed, but right now requires that a chapter or section is passed.
No dialog, no error messages, just core functionality. This took me the better part of a few hours so I would hope someone with more experience can take it from here.
@jojo2357
Copy link
Contributor Author

jojo2357 commented Nov 3, 2022

All tests via gradle passed locally on ubuntu, not sure what is going on there.

@PHPirates PHPirates added this to the b0.7.25 milestone Nov 3, 2022
@PHPirates
Copy link
Collaborator

All tests via gradle passed locally on ubuntu, not sure what is going on there.

If you click through on the red cross, you can see it's the linter that's failed. You can easily fix this by running the ktlintFormat gradle task

Created Files#getUniqueFileName(String, String?). Should have no impact on existing code, but allows creating the smallest unique file.
It took a lot of hoop-jumping, but now MoveSectionToFile can be undone which will properly undo file creation. It will also use the first availible filename.
@jojo2357
Copy link
Contributor Author

jojo2357 commented Nov 3, 2022

Oh those are code-style related. I dont see the project having its own formatting rules, or at least the default one makes that gradle task scream red at me. I fixed the issues by hand this time and I would much appreciate not having to do that every time so i can use the shortcut

@PHPirates
Copy link
Collaborator

I dont see the project having its own formatting rules

It does, see the .editorconfig file. I think IntelliJ should pick that up automatically, but not sure

@jojo2357
Copy link
Contributor Author

jojo2357 commented Nov 4, 2022

I have "Enable editorconfig support" ticked, but it still doesnt want to get the indentations right

@jojo2357 jojo2357 requested review from PHPirates and removed request for stenwessel, slideclimb and HannahSchellekens November 9, 2022 08:31
Copy link
Collaborator

@PHPirates PHPirates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, it works great for me! Thanks so much for adding all the tests :)
Just a few minor things and then it should be good to go.

@PHPirates PHPirates self-requested a review November 9, 2022 12:21
@jojo2357
Copy link
Contributor Author

jojo2357 commented Nov 9, 2022

So I think that scope selection is silly, and will only implement it on request, search in comments is silly, and will do so only on request, and I am satisfied with the state of it pending @PHPirates 's review

Copy link
Collaborator

@PHPirates PHPirates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one exception which I couldn't reproduce myself: (I think intellij was still in progress with resolving files or something?)

java.lang.IllegalStateException: Inline this requested with no original reference (2)
	at nl.hannahsten.texifyidea.refactoring.inlinefile.LatexInlineFileProcessor.performRefactoring(LatexInlineFileProcessor.kt:52)
	at com.intellij.refactoring.BaseRefactoringProcessor.lambda$doRefactoring$10(BaseRefactoringProcessor.java:520)
	at com.intellij.refactoring.BaseRefactoringProcessor.callPerformRefactoring(BaseRefactoringProcessor.java:574)
	at com.intellij.refactoring.BaseRefactoringProcessor.lambda$doRefactoring$11(BaseRefactoringProcessor.java:519)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runEdtProgressWriteAction$6(ApplicationImpl.java:919)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:190)
...

@jojo2357
Copy link
Contributor Author

jojo2357 commented Nov 10, 2022

How did you do that? Was it seemingly random and fixed itself?

@PHPirates
Copy link
Collaborator

I think I clicked "Inline this and keep file" but not sure

@jojo2357
Copy link
Contributor Author

Woah I duplicated it

Copy link
Collaborator

@PHPirates PHPirates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Do you want to write the documentation for the wiki as well?

@jojo2357
Copy link
Contributor Author

Oh, right. theres a wiki. Do you have something in mind? Maybe I could after I make a solution for #2751 to complete the inline concept to the extent that the IDEA space has for other languages?

@PHPirates
Copy link
Collaborator

Sure, that's fine

@PHPirates PHPirates merged commit 1052cc4 into Hannah-Sten:master Nov 10, 2022
@jojo2357 jojo2357 deleted the InlineInput branch November 10, 2022 09:21
@jojo2357
Copy link
Contributor Author

Actually I will make the page. I had thought there was code and commits to deal with but that isnt the case so I will write a page to get it started

@PHPirates
Copy link
Collaborator

Thanks! It's actually still code and commits though, just a different repo. You can also clone the wiki locally to edit it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline \include intention/inline file
3 participants