Skip to content

Commit

Permalink
Add synonym search to dictionary
Browse files Browse the repository at this point in the history
Duplicate dictionary entries for synonyms to replicate how the dictionary was structured in LC 7.  Fix for Bug 18305.
  • Loading branch information
bwmilby committed Jun 29, 2017
1 parent 41e31dc commit 5298f7c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ide-support/revdocsparser.livecodescript
Expand Up @@ -240,6 +240,7 @@ function revDocsParseDictionaryToLibraryArray pRootDir
end if

# Get the list of canonical glossary entries
-- Do not see where this is used in this module
local tGlossaryA
put revDocsCollectGlossarySynonyms(pRootDir) into tGlossaryA

Expand Down Expand Up @@ -268,6 +269,17 @@ function revDocsParseDictionaryToLibraryArray pRootDir
put revDocsParseDocText(tText, tFullPath) into tParsedA
put tParsedA["doc"][1] into tLibraryA[tCount]
add 1 to tCount
-- BWM fix for Bug 18305
if tParsedA["doc"][1]["Synonyms"] is not "" then
put tParsedA["doc"][1]["display name"] into tKeyWord
put tParsedA["doc"][1]["Synonyms"] into tSynonymA
repeat for each element tSynonymKey in tSynonymA
if tSynonymKey is tKeyWord then next repeat -- glossary entries include themselves
put tParsedA["doc"][1] into tLibraryA[tCount]
put tSynonymKey & " (Synonym of " & tKeyWord & ")" into tLibraryA[tCount]["display name"]
add 1 to tCount
end repeat
end if
end repeat
end repeat
end repeat
Expand Down

4 comments on commit 5298f7c

@BerndN
Copy link

@BerndN BerndN commented on 5298f7c Jun 29, 2017

Choose a reason for hiding this comment

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

Hi Brian,
note that it is encouraged to use strict compilation mode in the IDE, in fact all recent modifications painstakenly use strict compilation.

And no, your change did not include synonyms in the dictionary.
I tested by exchanging your modified version of revdocsparser.livecodescript in the bundle of LC 9 DP6 and made sure the cache in "application support" -> "rev" was cleared from the cached dictionary stuff. Then restarted LC 9 DP6 and it created a new cache, but unfortunately no synomyms in the dictionary.
All this IDE stuff is pretty intertwined and I have not yet figured out how the dictionary works.

@bwmilby
Copy link
Owner Author

@bwmilby bwmilby commented on 5298f7c Jul 4, 2017

Choose a reason for hiding this comment

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

Hmm... This doesn't add them for the cache though, it would only do so for the initial build of the api.sqlite file from the source docs (not sure if that is what you did above). I need to make some corrections for the glossary anyway. I'll be sure to have strict on for the update. Thanks for giving it a run though.

@bwmilby
Copy link
Owner Author

@bwmilby bwmilby commented on 5298f7c Jul 4, 2017

Choose a reason for hiding this comment

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

The code in Toolset/home.livecodescript seems to be the driver. The "openstack" ends up calling "revInternal__openStack". The startup is logged in the "LiveCodeToolsLog.txt" file. The following happens every startup:
Cleaning Cache
Enter Cleaning Docs Cache
Leave Cleaning Docs Cache
After this point, there is a call to "revEnvironmentIsInstalled" - it will need to be "false" for the handler to get called that does the dictionary build. If it gets called, the following will get logged:
Building Dictionary
At that point, "revIDEGenerateDistributedDocs" will get called (Toolset/libraries/revidelibrary.8.livecodescript) which in turn calls "revIDEGenerateDistributedAPI". "revEnvironmentRepositoryPath" is used to get a path (which is empty when I call it directly on my LC9DP7 build). Next step is to check to see if any files in the repo are newer than the script.js file. I'm still working though the code to see how to rebuild the docs while using an Indy build. I may need to download the community version. I'm not sure I want to go all the way to building the entire project (and not sure I really could).

@bwmilby
Copy link
Owner Author

@bwmilby bwmilby commented on 5298f7c Jul 4, 2017

Choose a reason for hiding this comment

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

Testing process:

create a local repository of the entire document tree from GitHub (tRepoPath)
make the entire LiveCode application directory writable by current user

edit "revIDEGenerateDistributedAPI" and add following line (with correct path). Should point to the parent directory containing "docs".

put "C:/Users/milby/Documents/GitHub/livecode" into tRepoPath

edit "revIDEGenerateDistributedDocs" and change path to "revdocsparser.livecodescript".

start using stack ("C:/Program Files (x86)/RunRev/LiveCode Indy 9.0 (dp 6)/Toolset/libraries" & slash & "revdocsparser.livecodescript")

edit "revDocsParseDictionaryToLibraryArray"

use code from the patch

call "revIDEGenerateDistributedDocs"

created another branch (bug-18305) and issued pull request against it (5669).

Please sign in to comment.