conjure-cp / conjure

Conjure: The Automated Constraint Modelling Tool
Other
96 stars 22 forks source link

Sequence domains #630

Closed N-J-Martin closed 10 months ago

N-J-Martin commented 10 months ago

last one for now @hz66-404 !

hz66-404 commented 10 months ago

Should we specify that all markdown file names start with L_?

ozgurakgun commented 10 months ago

(also, I noticed the clean commit history, yay!)

ozgurakgun commented 10 months ago

Should we specify that all markdown file names start with L_?

I don't think it's that simple. We need to understand what conjure-vs-code is doing when looking up the documentation first.

ozgurakgun commented 10 months ago

In fact it's coming from the LSP support inside Conjure. Somewhere around here https://github.com/conjure-cp/conjure/blob/038b65effda3beb6d0763462fd0c8670630298b2/src/Conjure/LSP/Documentation.hs#L55

ozgurakgun commented 10 months ago

OK, this isn't that simple as I suspected.

All calls to putDocs in the new lsp-doc-fetching branch I just created are potential keywords we need to cover.

See #631 for this branch.

This is less tied to lexemes/tokens as I thought it was. It should still be the lexeme name for symbolic operators (things like +-/*).

Currently I have the following places where putDocs is called.

$ grep putDocs -rn src
[ ... removed function definition ... ]
src/Conjure/Language/Validator.hs:516:  putDocs KeywordD "such_that" (makeTree l1 `mappend` makeTree l2)
src/Conjure/Language/Validator.hs:526:  putDocs KeywordD "branching_on" (makeTree l1 `mappend` makeTree l2)
src/Conjure/Language/Validator.hs:541:    FindStatement l1 fs -> l1 `isA` TtKeyword >> putDocs KeywordD "find" l1 >> validateStatementSeq SFind validateFind fs
src/Conjure/Language/Validator.hs:542:    GivenStatement l1 gs -> l1 `isA` TtKeyword >> putDocs KeywordD "given" l1 >> validateStatementSeq SGiven validateGiven gs
src/Conjure/Language/Validator.hs:543:    LettingStatement l1 ls -> l1 `isA` TtKeyword >> putDocs KeywordD "letting" l1 >> validateStatementSeq SLetting validateLetting ls
src/Conjure/Language/Validator.hs:565:    putDocs KeywordD "new_type_enum" [l1, l2, l3]
src/Conjure/Language/Validator.hs:599:  putDocs KeywordD "letting_domain" [lt]
src/Conjure/Language/Validator.hs:608:  putDocs KeywordD "new_type_enum" [l1, l2, l3]
src/Conjure/Language/Validator.hs:633:  putDocs KeywordD "letting_unnamed" [l1, l2, l3, l4]
src/Conjure/Language/Validator.hs:693:    putDocs TypeD "tuple" l1
src/Conjure/Language/Validator.hs:697:    putDocs TypeD "record" l1
src/Conjure/Language/Validator.hs:701:    putDocs TypeD "variant" l1
src/Conjure/Language/Validator.hs:705:    putDocs TypeD "matrix" l1
src/Conjure/Language/Validator.hs:711:    putDocs TypeD "set" l1
src/Conjure/Language/Validator.hs:716:    putDocs TypeD "mset" l1
src/Conjure/Language/Validator.hs:721:    putDocs TypeD "function" l1
src/Conjure/Language/Validator.hs:726:    putDocs TypeD "sequence" l1
src/Conjure/Language/Validator.hs:731:    putDocs TypeD "relation" l1
src/Conjure/Language/Validator.hs:736:    putDocs TypeD "partition" l1
src/Conjure/Language/Validator.hs:995:  putDocs AttributeD (T.pack $ show name) t
src/Conjure/Language/Validator.hs:1005:  putDocs AttributeD (T.pack $ show name) t
src/Conjure/Language/Validator.hs:1176:      putDocs KeywordD (T.pack $ show name') name
src/Conjure/Language/Validator.hs:1189:      putDocs KeywordD "powerset_projection" lt
src/Conjure/Language/Validator.hs:1233:  putDocs FunctionD (lexemeText name') name
src/Conjure/Language/Validator.hs:1256:  putDocs OperatorD (T.pack $ "pre_" ++ show op) lt
src/Conjure/Language/Validator.hs:1285:  putDocs OperatorD "post_factorial" lt
src/Conjure/Language/Validator.hs:1600:  putDocs KeywordD "expr_in_domain_projection" l1
src/Conjure/Language/Validator.hs:1609:  putDocs KeywordD "expr_projection" lt
N-J-Martin commented 10 months ago

OK, this isn't that simple as I suspected.

All calls to putDocs in the new lsp-doc-fetching branch I just created are potential keywords we need to cover.

See #631 for this branch.

This is less tied to lexemes/tokens as I thought it was. It should still be the lexeme name for symbolic operators (things like +-/*).

Currently I have the following places where putDocs is called.

$ grep putDocs -rn src
[ ... removed function definition ... ]
src/Conjure/Language/Validator.hs:516:  putDocs KeywordD "such_that" (makeTree l1 `mappend` makeTree l2)
src/Conjure/Language/Validator.hs:526:  putDocs KeywordD "branching_on" (makeTree l1 `mappend` makeTree l2)
src/Conjure/Language/Validator.hs:541:    FindStatement l1 fs -> l1 `isA` TtKeyword >> putDocs KeywordD "find" l1 >> validateStatementSeq SFind validateFind fs
src/Conjure/Language/Validator.hs:542:    GivenStatement l1 gs -> l1 `isA` TtKeyword >> putDocs KeywordD "given" l1 >> validateStatementSeq SGiven validateGiven gs
src/Conjure/Language/Validator.hs:543:    LettingStatement l1 ls -> l1 `isA` TtKeyword >> putDocs KeywordD "letting" l1 >> validateStatementSeq SLetting validateLetting ls
src/Conjure/Language/Validator.hs:565:    putDocs KeywordD "new_type_enum" [l1, l2, l3]
src/Conjure/Language/Validator.hs:599:  putDocs KeywordD "letting_domain" [lt]
src/Conjure/Language/Validator.hs:608:  putDocs KeywordD "new_type_enum" [l1, l2, l3]
src/Conjure/Language/Validator.hs:633:  putDocs KeywordD "letting_unnamed" [l1, l2, l3, l4]
src/Conjure/Language/Validator.hs:693:    putDocs TypeD "tuple" l1
src/Conjure/Language/Validator.hs:697:    putDocs TypeD "record" l1
src/Conjure/Language/Validator.hs:701:    putDocs TypeD "variant" l1
src/Conjure/Language/Validator.hs:705:    putDocs TypeD "matrix" l1
src/Conjure/Language/Validator.hs:711:    putDocs TypeD "set" l1
src/Conjure/Language/Validator.hs:716:    putDocs TypeD "mset" l1
src/Conjure/Language/Validator.hs:721:    putDocs TypeD "function" l1
src/Conjure/Language/Validator.hs:726:    putDocs TypeD "sequence" l1
src/Conjure/Language/Validator.hs:731:    putDocs TypeD "relation" l1
src/Conjure/Language/Validator.hs:736:    putDocs TypeD "partition" l1
src/Conjure/Language/Validator.hs:995:  putDocs AttributeD (T.pack $ show name) t
src/Conjure/Language/Validator.hs:1005:  putDocs AttributeD (T.pack $ show name) t
src/Conjure/Language/Validator.hs:1176:      putDocs KeywordD (T.pack $ show name') name
src/Conjure/Language/Validator.hs:1189:      putDocs KeywordD "powerset_projection" lt
src/Conjure/Language/Validator.hs:1233:  putDocs FunctionD (lexemeText name') name
src/Conjure/Language/Validator.hs:1256:  putDocs OperatorD (T.pack $ "pre_" ++ show op) lt
src/Conjure/Language/Validator.hs:1285:  putDocs OperatorD "post_factorial" lt
src/Conjure/Language/Validator.hs:1600:  putDocs KeywordD "expr_in_domain_projection" l1
src/Conjure/Language/Validator.hs:1609:  putDocs KeywordD "expr_projection" lt

This does seem like a problem that needs solving, but I think to dedicate the proper time to it, we need to wait until next semester.

ozgurakgun commented 10 months ago

This does seem like a problem that needs solving, but I think to dedicate the proper time to it, we need to wait until next semester.

Agreed!

Can you make an issue for this so we don't forget please? This PR will be merged soon...