bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59979: 30.0.50; dockerfile-ts-mode imenu issue


From: Randy Taylor
Subject: bug#59979: 30.0.50; dockerfile-ts-mode imenu issue
Date: Mon, 12 Dec 2022 02:30:28 +0000

On Sunday, December 11th, 2022 at 18:57, Randy Taylor <dev@rjt.dev> wrote:
> 
> On Sunday, December 11th, 2022 at 15:39, Eshel Yaron via "Bug reports for GNU 
> Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
> 
> > I stumbled upon the following issue while checking out the new
> > dockerfile-ts-mode.
> > 
> > 1. emacs -Q
> > 2. C-x C-f /tmp/Dockerfile
> > 3. Insert the following contents (taken from
> > https://docs.docker.com/build/building/multi-stage/#use-a-previous-stage-as-a-new-stage):
> > 
> > FROM ubuntu AS base
> > RUN echo "base"
> > 
> > FROM base AS stage1
> > RUN echo "stage1"
> > 
> > FROM base AS stage2
> > RUN echo "stage2"
> > 
> > 4. Try to use M-x imenu to navigate to the last build stage
> > 4.a. We get the following imenu--index-alist:
> > 
> > (("Stage"
> > ("ubuntu" . #<marker at 1 in Dockerfile>)
> > 
> > ("base" . #<marker at 42 in Dockerfile>)
> > 
> > ("base" . #<marker at 81 in Dockerfile>)))
> > 
> > 4.b. Consequently, we can't choose and jump to the last stage, because
> > dockerfile-ts-mode calls both of the last two stages by the same name
> > ("base").
> > 
> > The crux of the issue is that dockerfile-ts-mode uses a stage's base
> > image as its name, which seems kinda wrong and leads to ambiguity since
> > many stages can have a common base image. Instead, it would be
> > preferable IMO to use the index of the stage or, when available, its
> > unique name (such as "stage1" in the example above).
> > 
> > Thanks!
> 
> 
> Thanks, I'll take a look and hopefully reply back with a patch in a bit.
> 

I didn't notice this because I use conult-imenu, which will add an index for 
any duplicates. imenu doesn't do this, and for other modes like c-mode, 
c++-mode, org-mode, etc., only the first entry gets shown.

I've attached a patch which will use the stage name if it's available, 
otherwise use the base image.

Attachment: 0001-Improve-dockerfile-ts-mode-imenu-generation-Bug-5997.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]