the-carlisle-group / Acre-Desktop

A simple Dyalog APL IDE plugin that introduces "projects" and allows you to keep your source code in Unicode text files.
MIT License
11 stars 1 forks source link

ProjectSpace Default #198

Closed PaulMansour closed 4 years ago

PaulMansour commented 5 years ago

The ProjectSpace parameter defaults to the last node name of the path.

I propose it default to the last two node names of the path.

For example, if the path is c:\APLProjects\Dyalog\Dfns, the ProjectSpace would default to #.Dyalog.Dfns

PhilLast commented 5 years ago

It's no skin off my nose.

Assume the priority remains:

  1. Optional second item in OpenProject argument.
  2. ProjectSpace config parameter.
  3. as suggested.
PaulMansour commented 5 years ago

Yes. One other thing I haven't checked yet, it might already work, but I need Acre to replace non-acceptable characters in the name with underscores. So for example if the project folder is:

c:\APLProjects\Dyalog\Dfns-1.2.3'

Then the default namespace is:

#.Dyalog\Dfns_1_2_3
PhilLast commented 5 years ago

As opposed to

! Invalid namespace name
* Command Execution Failed:

Not a bad idea.

PhilLast commented 5 years ago

I think it's unlikely that (at least at present) anyone is relying on the current default but if they are they might be surprised by the change that will push their projects down a level in the tree.

All newly created projects, by CreateProject, require a project space to be specified so the default only comes into operation if the ProjectSpace parameter is deliberately removed from the config file or the project is created outside of acre's remit. An invalid config file used to cause all defaults to take effect but now throws an error.

I've implemented both of Paul's requests. I'm sure any ensuing problems will be reported here.

Next commit.

aplteam commented 5 years ago

It does not hit me because in my user command ]OpenMyAcreProject I am specifying the space anyway, and for any given project foo it is _foo.

However, I am not sure this is a good idea.

Maybe the default ccould be * which would be the same as empty, but could be *.* doing what Paul is after?

PaulMansour commented 5 years ago

Kai's suggestion of *.* is fine by me. In fact, maybe my request was a bit premature, as I could certainly do what Kai is doing and specify the space on loading. However, I would prefer the option of specifying *.* in the config file, or as Phil as now enhanced it, as it removes a redundant piece of information, and it makes it much cleaner for me.

PhilLast commented 5 years ago

I first read Kai's suggestion as "." (I probably had on only one pair of glasses) and wondered what it was supposed to signify.

*.* is OK so long as it is considered to be a unitary symbol having the specific meaning of Paul's first request while Kai's * follows the current default which would remain as the last node. Both options would be "normalised" with _ as specified by Paul's second request. Any other input than a valid namespace path would trigger an error.

I say this because the asterisk usually indicates a wild-card and suggests some leeway that might be difficult to specify, document and implement.

aplteam commented 5 years ago

Well, it is a wildcard, it's just that a single one catches the last part of a path while *.* catches the last two.

But it might be better to demand */* rather than *.*, I am not sure.

PaulMansour commented 5 years ago

I agree the asterisk is a bit misleading. We could also do something like:

#.[ProjectParentFolder].[ProjectName]

Though its a bit verbose, but i think it does conform with the way many apps deal with this kind of thing. Regardless it might be good idea to include the # even if we use . so we might write:

#.SomeSpace.*.*
PaulMansour commented 5 years ago

Is not a wild card. Its a key word like when you specify a special windows directory.

PaulMansour commented 5 years ago

We are defining a workspace path, not a file path, so . is more appropriate than / I think.

PaulMansour commented 5 years ago

Wow, typing a backtick here launches a Dyalog autocomplete for symbols. Never saw that before. This is in Brave.

PaulMansour commented 5 years ago

I realize I actually use the term ProjectAuthor for the parent folder name of the project. Correct me if I am wrong, but by definition, the name of a project is the name of the folder - there is no place we store the name of a project separately from that. Similarly, by convention, I use the Author name (also the github account) for the parent folder.

A project is thus universally named as something like PaulMansour/Stats or Dyalog/Dfns. I think Acre already buys into this, as when project names are analyzed in the open or dependencies parameter.

Thus we could use:

#.SomeSpace.[ProjectAuthor].[ProjectName]
PhilLast commented 5 years ago

The config parameter that stores this has been called ProjectFolder since acre v4.0.1 that was the first to be called Acre-Desktop. There was something called ProjectName but it was deemed to be redundant and I can no longer remember what it was used for.

But as regards #.SomeSpace.[ProjectAuthor].[ProjectName] I assume this means strictly the normalised last two nodes in the path to the project folder within #.SomeSpace. In which case I see no reason why we can't avoid the likelihood of typos and just do #.SomeSpace.*.*.* with as many or few asterisks as required.

PhilLast commented 5 years ago

... or some other character.

PaulMansour commented 5 years ago

That's fine with me. I don't know what other char besides asterisk. For my purposes it will generally be set to #.*.*

Regarding the terminology I use ProjectAuthor and ProjectName to refer respectively to the last two segments of the ProjectFolder. ProjectAuthor is also the GitHub account if I keep it on GitHub. I also use project name is to refer to the combination of the two. My point was that ProjectFolder is not stored anywhere or defined by the user. It is what it is.

I realize that Acre does not formally define these two extra terms, but I find them quite useful.

PhilLast commented 5 years ago

I've implemented the following

In this context normalised means that all non-name characters .-# &c. are replaced one-to-one by _ and separators /\ by .

e.g. alpha-bravo.charlie/delta-echo.foxtrot/alpha_bravo_charlie.delta_echo.foxtrot