Skip to content

Don't show completions on nested module identifier#13089

Merged
psfinaki merged 23 commits into
dotnet:mainfrom
kerams:mod
Mar 10, 2023
Merged

Don't show completions on nested module identifier#13089
psfinaki merged 23 commits into
dotnet:mainfrom
kerams:mod

Conversation

@kerams

@kerams kerams commented May 3, 2022

Copy link
Copy Markdown
Contributor

A simple fix.

module Namespace.Top

module Nest // =

This test is failing because without the equals sign Nest does not appear in the syntax tree at all. What exactly would it take to make this happen? I'm assuming something in the parser. Unfortunately, I am not yet familiar with that part of the compiler.

dsyme
dsyme previously approved these changes May 8, 2022
@dsyme

dsyme commented May 8, 2022

Copy link
Copy Markdown
Contributor

Code looks ok but the new test is still failing

@dsyme dsyme dismissed their stale review May 8, 2022 14:49

test still failing

@kerams

kerams commented May 8, 2022

Copy link
Copy Markdown
Contributor Author

I know and I have described why that is. Any clue on how to go about what I'm asking for?

@kerams

kerams commented May 17, 2022

Copy link
Copy Markdown
Contributor Author

Would it be necessary to add isFromErrorRecovery to SynModuleDecl.NestedModule (a la SynExpr.IfThenElse) to that end? Adding FromParseError does not seem like a good fit here.

For the sole reason that this nested module would appear in the syntax tree

namespace N

module Nested

@kerams

kerams commented Oct 27, 2022

Copy link
Copy Markdown
Contributor Author

Bump?

@vzarytovskii vzarytovskii requested a review from a team as a code owner October 27, 2022 14:34
@psfinaki

Copy link
Copy Markdown
Contributor

/azp run

@vzarytovskii

Copy link
Copy Markdown
Member

/run fantomas

@github-actions

Copy link
Copy Markdown
Contributor

@psfinaki psfinaki added this to the November-2022 milestone Oct 31, 2022
@psfinaki

Copy link
Copy Markdown
Contributor

@kerams if you want I might help with that later this week.

@kerams

kerams commented Nov 1, 2022

Copy link
Copy Markdown
Contributor Author

Well, first I want to know whether we're OK with extending the syntax tree just for this use case. If that isn't the case, the PR can be closed. Otherwise I only need a tip on the preferred approach with regards to modelling the error case.

@psfinaki

psfinaki commented Nov 1, 2022

Copy link
Copy Markdown
Contributor

Well from what I understand @dsyme is fine with that and nobody is against in general :)

@kerams

kerams commented Feb 9, 2023

Copy link
Copy Markdown
Contributor Author

I've added recovery for incomplete nested modules.

Before:

m99eoBsd6i

After:

prkSvMQG8M

@auduchinok, @nojaf , before I add tests and extend this to signature files, can you please check if the changes look sound to you?

@kerams

kerams commented Feb 9, 2023

Copy link
Copy Markdown
Contributor Author

Ugh, it doesn't work with ML compatibility mode

#indent "off"
module M

let SimpleSample() = 1

Is there a way to simulate a pattern guard in yacc?

| opt_attributes opt_access moduleIntro // when not mlSupport

Or maybe it's time this long-deprecated syntax was finally removed in .NET 8 SDK? :)

@nojaf

nojaf commented Feb 10, 2023

Copy link
Copy Markdown
Contributor

@auduchinok, @nojaf, before I add tests and extend this to signature files, can you please check if the changes look sound to you?

I think this looks fine, though I'm less familiar with recovery. I'll let @auduchinok take this one.

@kerams

kerams commented Feb 10, 2023

Copy link
Copy Markdown
Contributor Author

If I add recover at the end, #indent "off" works, but the original error on the following declaration is preserved. It's not a big deal, but it does not add any value with the new diagnostic.

image

@auduchinok

Copy link
Copy Markdown
Member

If I add recover at the end, #indent "off" works, but the original error on the following declaration is preserved. It's not a big deal, but it does not add any value with the new diagnostic.

If all is working by itself with recover added, then the additional error shouldn't be needed. Are there any other issues with recover added?

@kerams

kerams commented Feb 11, 2023

Copy link
Copy Markdown
Contributor Author

The Moon and the stars have aligned, ready for review.

@nojaf

nojaf commented Feb 11, 2023

Copy link
Copy Markdown
Contributor

As you changed the pars.fsy grammar rules, I would very much like to see a test in https://github.com/dotnet/fsharp/blob/main/tests/service/SyntaxTreeTests.fs where this new AST is constructed. Could you please an example file and a baseline file to https://github.com/dotnet/fsharp/tree/main/tests/service/data/SyntaxTree?

@nojaf

nojaf commented Feb 11, 2023

Copy link
Copy Markdown
Contributor

Thanks @kerams 🙏

@auduchinok auduchinok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kerams I wonder if changes to LexFilter are still needed after you've changed recovery to use the builtin logic?

Comment thread src/Compiler/pars.fsy
@T-Gro

T-Gro commented Feb 16, 2023

Copy link
Copy Markdown
Member

(updating to get the "short ranges" string representation in)

@psfinaki

Copy link
Copy Markdown
Contributor

@kerams this is ready to merge, right?

@kerams

kerams commented Mar 10, 2023

Copy link
Copy Markdown
Contributor Author

Yup.

@psfinaki psfinaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool, thanks a lot!

@psfinaki psfinaki merged commit 695aacc into dotnet:main Mar 10, 2023
@kerams kerams deleted the mod branch March 10, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants