1

I have imported a framework in eclipse. It contains files with .sah extension. I want eclipse to consider those .sah files as .js files (javascript files), so that editing and working on that frameworks get easier. So that I can use short cuts like F3(like pressing F3 takes us to function defnition in java project) and all..

Thanks..

smith
  • 87
  • 7
  • Right-click a `.sah` file and choose _Open With > Others..._, select the JavaScript editor, check _Use it for all '.sah' files_ and click _OK_. – howlger May 25 '18 at 08:09
  • @howlger I did that, To test it I created two .sah files, In one I created methods and in other I called those methods. Now I opened those two files as u suggested. I went to one file where I have called methods and selected method and pressed F3, it did not move me to function defnition. I tried with cntrl+click then also it does not took me to methos defnition. But when I changed those two files extension to .js extension and irrespective of opening them with the way u described above. When i press F3 it takes me to function defnition. – smith May 25 '18 at 08:19

2 Answers2

3

To treat .sah files as .js files, do the following:

  1. In Window > Preferences: General > Content Types select the content type Text > JavaScript Source File
  2. In the section File associations click Add... and enter *.sah

Make sure, the project is a JavaScript project and the .sah files are in the Include Path (Project > Properties: JavaScript > Include Path, tab Source).

howlger
  • 31,050
  • 11
  • 59
  • 99
  • howlger With the solutions you have suggested , it is just going to highlight variables , keywords etc. My problem is : If a function with name "gettest()" is called in one .sah file , If I select "gettest()" and press F3 then it should take me directly to the .sah file where I have defined function "gettest()". – smith Jun 04 '18 at 08:07
  • Navigation between two `.sah` files works for me, if the content type was registered as described (_Open With..._ for all `.sah` files is not sufficient) and both files are in the include path (which is only possible if `.sah` is registered as content type and not as file association). – howlger Jun 04 '18 at 11:32
0

I don't have enough reputation to comment on howlger's answer, so to expand on that answer:

If you're file is not found as a Child of Text in Window > Preferences: General > Content Types, then you may need use Add Child to add your filetype (e.g., SAH) as a Child of Text. Then add the file association in File associations (e.g., *.sah), within the same window. Then add your preferred editor in Associated editors (e.g., Text Editor), also in the same window.

Nicolas Mora
  • 41
  • 1
  • 2